EasyUI Forum

General Category => Bug Report => Topic started by: sphsyv on August 07, 2017, 02:31:49 AM



Title: Calendar week bug
Post by: sphsyv on August 07, 2017, 02:31:49 AM
2017-08-07 week
31 or 33 ?

2017.8.7
It should be week 33rd, not 31 weeks.


Title: Re: Calendar week bug
Post by: jarry on August 08, 2017, 05:50:05 AM
That isn't the bug. You can override the $.fn.calendar.defaults.getWeekNumber function to achieve your own logic.
Code:
$.extend($.fn.calendar.defaults, {
getWeekNumber: function(date){
var checkDate = new Date(date.getTime());
checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
var time = checkDate.getTime();
checkDate.setMonth(0);
checkDate.setDate(1);
return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
}
});