dpicker icon indicating copy to clipboard operation
dpicker copied to clipboard

Day in month table no marked as active, when using moment.timezone

Open stereonom opened this issue 3 years ago • 1 comments

Hi!

The problem is this line let currentDayModel = new Date(currentYear, dayMonth - 1, day) https://github.com/soyuka/dpicker/blob/ce8d2aa11b599051278d107ccccbe08e48a09e7b/src/dpicker.js#L507

Because after that u are using the moment-adapter to compare currentDayModel with min and max using isSameOrAfter / isSameOrBefore

When moments timezone is set to another timezone, the day u are comparing is not on the day currentDayModel is.

stereonom avatar Apr 23 '21 10:04 stereonom

I found a solution:

let currentDayModel = new Date(Date.UTC(currentYear, dayMonth - 1, day));

stereonom avatar Apr 26 '21 07:04 stereonom