moment / moment-timezone

Timezone support for moment.js
momentjs.com/timezone
MIT License
3.83k stars 838 forks source link

Weird issue: moment-timezone is subtracting 1 hour from every timezone #1108

Closed adrianmarinSH closed 4 months ago

adrianmarinSH commented 4 months ago

Hello, I have found a weird issue happening in my project with moment-timezone, for some reason when I change the timezone or I want to get the current date formatted in another timezone the date is being returned with 1 hour subtracted.

It seems like if the library or something got stuck in day-light change or something like that and is returning weird dates.

I would like to see if someone could help me and tell me if they have had the same problem or know how to fix it.

I have tried to update the moment and moment-timezone libraries to the last versions but the problem keeps happening.

In the example I'm using the method moment(date).tz(timezone).format() I have also tried using moment.tz(date, timezone).format() but the issue is the same.

Thanks!!!

Screenshot 2024-06-13 at 17 40 18

sslincoco commented 4 months ago

您的邮件已收到,我会尽快给您回复。

adrianmarinSH commented 4 months ago

I found out the issue, the problem was that I had a local file of timezones from old version of the moment-timezone package, looks like because of the way Meteor reads the files, this file located in client/lib was being reading before the file of the last version of the package.

After deleting this file the issue was fixed. Leaving the solution here if someone has the same problem