From 732e421bff2e17769e7073fa4393c23ae014a38d Mon Sep 17 00:00:00 2001 From: Teemu Merikoski Date: Thu, 21 Jan 2016 10:50:25 +0200 Subject: [PATCH] Add a callback for getWeekOfYear command, onGetWeekOfYear. --- jquery.datetimepicker.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jquery.datetimepicker.js b/jquery.datetimepicker.js index 9c00413..23be5cb 100644 --- a/jquery.datetimepicker.js +++ b/jquery.datetimepicker.js @@ -480,6 +480,7 @@ onSelectDate: function () {}, onSelectTime: function () {}, onChangeMonth: function () {}, + onGetWeekOfYear: function () {}, onChangeYear: function () {}, onChangeDateTime: function () {}, onShow: function () {}, @@ -1297,6 +1298,12 @@ }; _this.getWeekOfYear = function (datetime) { + if (options.onGetWeekOfYear && $.isFunction(options.onGetWeekOfYear)) { + var week = options.onGetWeekOfYear.call(datetimepicker, datetime); + if (typeof week !== 'undefined') { + return week; + } + } var onejan = new Date(datetime.getFullYear(), 0, 1); return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7); };