fix: parsing timestamp in seconds in timezone plugin
solution to issue https://github.com/iamkun/dayjs/issues/2388
@iamkun new PR, according to the comment https://github.com/iamkun/dayjs/pull/2389#issuecomment-1725372843
Codecov Report
Patch coverage: 100.00% and no project coverage change.
Comparison is base (
8c7de64) 100.00% compared to head (54a2685) 100.00%. Report is 11 commits behind head on dev.
Additional details and impacted files
@@ Coverage Diff @@
## dev #2450 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 183 183
Lines 2198 2252 +54
Branches 593 637 +44
=========================================
+ Hits 2198 2252 +54
| Files Changed | Coverage Δ | |
|---|---|---|
| src/plugin/timezone/index.js | 100.00% <100.00%> (ø) |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thanks.
If we want to properly parse dayjs.tz(1690278073, 'X') from timestamp to date, maybe updating the logic in the costomParseFormat plugin is better?
Not to hard code the logic in the timezone plugin
If we want to properly parse
dayjs.tz(1690278073, 'X')from timestamp to date, maybe updating the logic in the costomParseFormat plugin is better?
Sorry for the long answer. Execution does not reach CustomParseFormat plugin, because it falls into this If (https://github.com/iamkun/dayjs/blob/305f54099172ada45d10ba4c9bb5ec95e2a9d441/src/plugin/timezone/index.js#L132), and there it is processed incorrectly, because it contains 10 digits, not 13.