mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-12-08 05:34:22 +00:00
Add a callback for getWeekOfYear command, onGetWeekOfYear.
This commit is contained in:
parent
72ff0b43e5
commit
732e421bff
@ -480,6 +480,7 @@
|
|||||||
onSelectDate: function () {},
|
onSelectDate: function () {},
|
||||||
onSelectTime: function () {},
|
onSelectTime: function () {},
|
||||||
onChangeMonth: function () {},
|
onChangeMonth: function () {},
|
||||||
|
onGetWeekOfYear: function () {},
|
||||||
onChangeYear: function () {},
|
onChangeYear: function () {},
|
||||||
onChangeDateTime: function () {},
|
onChangeDateTime: function () {},
|
||||||
onShow: function () {},
|
onShow: function () {},
|
||||||
@ -1297,6 +1298,12 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
_this.getWeekOfYear = function (datetime) {
|
_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);
|
var onejan = new Date(datetime.getFullYear(), 0, 1);
|
||||||
return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7);
|
return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user