1

I am using the following parameters with jsDatePick. Can someone tell me how to tell it to only display the current and next year without having to use PHP in my JavaScript?

datepicker = new JsDatePick({
  dateFormat: "%m/%d/%Y",
  yearsRange: [2013, 2014],
  limitFromToday: true,
  limitToWorkDays: true
});

I want to do this dynamically so next year, someone doesn't have to go in and update the code to change it to 2014 and 2015.

Thanks!

4

1 に答える 1

2

このようなもの?

var thisYear = new Date().getFullYear(),
    nextYear = thisYear + 1;

datepicker = new JsDatePick({
  dateFormat: "%m/%d/%Y",
  yearsRange: [thisYear, nextYear],
  limitFromToday: true,
  limitToWorkDays: true
});
于 2013-01-31T20:10:27.423 に答える