dayjs
dayjs copied to clipboard
Fix issue #1905 - problems with special timezone offsets
This PR solves problems with timezone offset that do not contain complete or half hours or that contain seconds. There are a few offsets of this kind in historical dates.
It should solve issue #1905 and part of issue #1996.
Codecov Report
Merging #2016 (681d029) into dev (b5b7be1) will not change coverage. The diff coverage is
100.00%.
@@ Coverage Diff @@
## dev #2016 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 181 181
Lines 2074 2074
Branches 544 544
=========================================
Hits 2074 2074
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/index.js | 100.00% <100.00%> (ø) |
|
| src/utils.js | 100.00% <100.00%> (ø) |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
Just a few more informations to the commits of this pr:
- the rounding to the nearest 15min in utcOffset() solves a problem with firefox that just does not exist any more. I tested the code in the current FF, Chrome and node LTS and for me it looks like this bug in FF was fixed a long time ago (somewhere on the way from FF24 to FF103). On the other hand this rounding creates a lot of problems with historical dates, where weird minute offset are not uncommon.
- the second problem appears in timezone offset containing seconds. In such a case dayjs shows a zone string that lookes like
+02:02.026666. The pr changes this to the correct value of02:02just as moment does it.
Both cases do not have an impact on current dates where to my knowledge such offsets do not exist.