Issue with converting to Europe/London timezone
See original GitHub issueDescribe the bug I have dates formatted in ISO-8601 format and use dayjs to convert them to different timezones. Conversion works file for all cases except for “Europe/London”. It seems the issue might apply to all timezones that match UTC one.
What i do is i use dayjs in an angular app where i have a custom pipe doing the following in the function:
dayjs.extend(utc);
dayjs.extend(timezone);
return dayjs(value).tz(tz).locale(locale).format(pattern);
where value is 2020-11-06T19:27:08Z
and tz Europe/London
and pattern DD MMM, HH:mm a
In this case i would expect 06 Nov, 19:27 pm
but i get 06 Nov, 17:27 pm
.
If i change timezone to something that does not match UTC like Europe/Athens
or Europe/Paris
the conversion works fine.
Information
- Day.js Version 1.9.6
- OS: [e.g. iOS]
- Browser Chrome/Firefox
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:15 (1 by maintainers)
Top Results From Across the Web
Issues when converting from Europe/London time to UTC
Googling tells me that UTC should be an hour behind Europe/London time but when I tried to write a unit test to verify...
Read more >Converting times between time zones - Microsoft Learn
This article explains how to convert times from one time zone to another and convert DateTimeOffset values that have limited time zone awareness ......
Read more >Converting time zones in R: tips, tricks and pitfalls
(By the way, GMT isn't always the same as London time: GMT is not affected by daylight savings.) So the problem of converting...
Read more >Time Zone Converter
Time Zone Converter. Converter Results: 10:04:26 Wednesday December 28, 2022 in GMT. Daylight Saving Time is not in effect on this date/time in...
Read more >Europe/London: Time Zone in United Kingdom, Current local ...
Time Zone Converter (Time Difference Calculator). Compare the local time of two timezones, countries or cities of the world. Europe/London ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok managed to get a better view on why this is happening. Problem seems to be timezone with locale usage. Check this link https://runkit.com/embed/gaitj4v88l8d
If i put .locale() call after .timezone() call i get the issue. If i put .locale() call before .timezone() call i get the correct time, but output is not localized based on locale. This is easier to verify with the greek locale
el
.Thanks @anzap. Everything works with enough duct tape I guess. Thanks for the workaround 👍