-
-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
date
filter appears to add DST correction to UTC dates
#604
Comments
Sorry I'm not familar with DST, it seems to correct all dates (even January) when you're now in DST. I'll dig into this issue latter. Another case for GMT/UTC like |
What seems to be happening is that the local DST is applied to date calculations for all timezones, and seems to depend on whether or not current time at execution is on the same side of DST as the date being rendered. In 2023, const inputDate = new Date("2023-03-20T12:00:00Z");
console.log(inputDate.toLocaleString("en-US", { timeZone: "America/New_York" }));
engine.parseAndRender(
`America/New_York: {{ inputDate | date: "%Y-%m-%dT%H:%M:%S%z", "America/New_York" }}
Europe/Paris: {{ inputDate | date: "%Y-%m-%dT%H:%M:%S%z", "Europe/Paris" }}`, { inputDate: inputDate }
).then(console.log) which gives the following results: $ TZ=America/New_York node test.js
3/20/2023, 8:00:00 AM
America/New_York: 2023-03-20T08:00:00-0400
Europe/Paris: 2023-03-20T13:00:00+0100
$ TZ=Europe/Paris node test.js
3/20/2023, 8:00:00 AM
America/New_York: 2023-03-20T07:00:00-0400
Europe/Paris: 2023-03-20T12:00:00+0100 The New York time output by liquidjs should stay the same regardless of local timezone (and equal to what |
🎉 This issue has been resolved in version 10.7.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Thanks @DeeUnderscore , your test cases helped a lot. Try v10.7.1, please let me know if any issue persists. |
Looks like it's solved in 10.7.1 for me. Thank you! |
Consider this example:
The output this produces:
I am in a timezone which does not use DST in January, but uses it in April. UTC never uses DST, but the January dates appear corrected for UTC (and still report
+0000
offset).This also happens with
preserveTimezones
set totrue
, and it happens with dates passed in as data:This is with liquidjs 10.7.0
The text was updated successfully, but these errors were encountered: