Vuepic / vue-datepicker

Datepicker component for Vue 3
https://vue3datepicker.com
MIT License
1.43k stars 142 forks source link

fix: fix timezone issues for getMonths function #818

Closed brunolopesr closed 5 months ago

brunolopesr commented 5 months ago

This pull request addresses issue #817

The date used to map the array of month numbers should not have explicitly set timezone in its ISO 8601 string, because in timezones like America/Sao_Paulo which has a negative offset of -3 hours, all dates will be computed one day earlier, eg: Sat Dec 31 2016 22:00:00 GMT-0200 (Horário de Verão de Brasília)

This will make the array of months to be something like: ['December', 'January', 'February', ..., 'November'], making a buggy behaviour in DatePicker and MonthPicker components.

I think the best way is to remove the timezone from the string and the timezone from the Intl.DateTimeFormat constructor, thus defaulting to the system timezone.

Also as I was running the tests in a negative offset, I made some adjustments to the timezone.spec.ts tests.

Jasenkoo commented 5 months ago

I already have a fix for it, a simpler change. Tnx for the PR tho.

brunolopesr commented 5 months ago

Guess I will need to use my fork of the library then.

gislainy commented 5 months ago

Why do you keep an open source project open if you do not accept third-party contributions other than your own?

Why didn't you suggest in @brunolopesr PR what the simpler solution would be?

If someone has spent their time contributing to this project and you simply respond with a message like that, believe me, you are not contributing positively to the community.