diff --git a/jquery.datetimepicker.js b/jquery.datetimepicker.js index c686855..6b3f27d 100644 --- a/jquery.datetimepicker.js +++ b/jquery.datetimepicker.js @@ -1304,9 +1304,7 @@ var datetimepickerFactory = function ($) { d.setDate(date.getDate()); } - if (options.yearOffset) { - d.setFullYear(d.getFullYear() + options.yearOffset); - } + d.setFullYear(d.getFullYear()); if (!norecursion && options.defaultTime) { time = _this.strtotime(options.defaultTime); @@ -1478,7 +1476,12 @@ var datetimepickerFactory = function ($) { }; _this.str = function () { - return dateHelper.formatDate(_this.currentTime, options.format); + var format = options.format; + if (options.yearOffset) { + format = format.replace('Y', _this.currentTime.getFullYear() + options.yearOffset); + format = format.replace('y', String(_this.currentTime.getFullYear() + options.yearOffset).substring(2, 4)); + } + return dateHelper.formatDate(_this.currentTime, format); }; _this.currentTime = this.now(); }; @@ -1751,7 +1754,7 @@ var datetimepickerFactory = function ($) { calendar.html(table); month_picker.find('.xdsoft_label span').eq(0).text(options.i18n[globalLocale].months[_xdsoft_datetime.currentTime.getMonth()]); - month_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear()); + month_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear() + options.yearOffset); // generate timebox time = ''; @@ -1817,8 +1820,8 @@ var datetimepickerFactory = function ($) { opt = ''; - for (i = parseInt(options.yearStart, 10) + options.yearOffset; i <= parseInt(options.yearEnd, 10) + options.yearOffset; i += 1) { - opt += '