kineticsocial / angularjs-datetime-picker

AngularJS DateTime Picker Without JQuery and Bootstrap
MIT License
66 stars 79 forks source link

The dates appear under the incorrect days in the datetime picker #48

Open nehay578 opened 7 years ago

nehay578 commented 7 years ago

screen shot 2017-09-25 at 1 20 48 pm As seen in the screenshot, today's date is 25th Sep, which is Monday, but the datetime picker shows 25th Sep under tuesday.

nehay578 commented 7 years ago

However, the date is correct in the picker in the live demos here: https://www.npmjs.com/package/angularjs-datetime-picker

tomsoderlund commented 6 years ago

This seems related to US “start weeks with Sunday” vs. Europe “start weeks with Monday”. Anyone know of a fix? @nehay578

vz28bh commented 4 years ago

This is kind of a critical bug...anyone looked at it?

vz28bh commented 4 years ago

I did some investigation, https://github.com/angular/angular.js/issues/11900, problem is that angular and javascript disagree on which day is 0. JavaScript Sunday=0, Angular $locale says Monday=0. So...if you change line 160 like this it fixes the problem:

firstDayOfWeek = ($locale.DATETIME_FORMATS.FIRSTDAYOFWEEK+1)%7 || 0;
maubarrerag commented 3 years ago

+1