EasyUI Forum
December 18, 2017, 09:19:19 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Calendar week bug  (Read 656 times)
sphsyv
Newbie
*
Posts: 8


View Profile Email
« 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.
« Last Edit: August 07, 2017, 02:49:15 AM by sphsyv » Logged
jarry
Administrator
Hero Member
*****
Posts: 1259


View Profile Email
« Reply #1 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;
}
});
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!