dayjs icon indicating copy to clipboard operation
dayjs copied to clipboard

Fix issue #1905 - problems with special timezone offsets

Open BePo65 opened this issue 3 years ago • 2 comments

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.

BePo65 avatar Aug 06 '22 14:08 BePo65

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.

codecov[bot] avatar Aug 06 '22 14:08 codecov[bot]

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 of 02:02 just as moment does it.

Both cases do not have an impact on current dates where to my knowledge such offsets do not exist.

BePo65 avatar Aug 06 '22 14:08 BePo65