ocadotechnology / hexagonjs

A modular, themable collection of components for modern browsers
https://www.hexagonjs.io
Apache License 2.0
51 stars 15 forks source link

Fix moment calendar #586

Closed charlieTheBotDev closed 2 years ago

charlieTheBotDev commented 2 years ago

Description

I found a bug related to calendar view and after investigating I found a mistake in hexagon.js code in function: DateTimeLocalizerMoment.prototype.weekDays = function() line 6924: dayDate = moment().weekday(0); line 6925: dayDate.locale(this.locale()); After setting dayDate starts from 0 you’re setting a locale, but locale doesn’t affect anything. Despite this locale settings we can see on Calendar that week starts from Sunday event if I changed locale (where week starts from Monday for example). There is should be another order of settings: first set locale and then set weekday like this: dayDate = moment().locale(this.locale()).weekday(0); Instead of these 2 lines of code: dayDate = moment().weekday(0); dayDate.locale(this.locale()); After testing my method I could see the correct view of Calendar regarding to locale.

Checklist: