question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parsing issue with timezone since 1.10.2

See original GitHub issue

Describe the bug Running v1.9.8:

console.log(dayjs('20170719T112552+0000'))

/*
    d {
      '$L': 'en',
      '$d': 2017-07-19T09:25:52.000Z,
      '$x': {},
      '$y': 2017,
      '$M': 6,
      '$D': 19,
      '$W': 3,
      '$H': 11,
      '$m': 25,
      '$s': 52,
      '$ms': 0
    }
*/

Running v1.10.2:

console.log(dayjs('20170719T112552+0000'))

/*
    d {
      '$L': 'en',
      '$d': Invalid Date,
      '$x': {},
      '$y': NaN,
      '$M': NaN,
      '$D': NaN,
      '$W': NaN,
      '$H': NaN,
      '$m': NaN,
      '$s': NaN,
      '$ms': NaN
    }
*/

Removing the timezone from the source string and the date is parsed again:

console.log(dayjs('20170719T112552'))

/*
    d {
      '$L': 'en',
      '$d': 2017-07-19T09:25:52.000Z,
      '$x': {},
      '$y': 2017,
      '$M': 6,
      '$D': 19,
      '$W': 3,
      '$H': 11,
      '$m': 25,
      '$s': 52,
      '$ms': 0
    }
*/

Looks like the regex (https://github.com/iamkun/dayjs/pull/1307) still need improvement I guess?

Expected behavior Date properly parsed.

Information

  • Day.js Version: 1.10.2
  • OS: macOS
  • Browser: node 12
  • Time zone: [e.g. GMT-07:00 DST (Pacific Daylight Time)]

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
iamkuncommented, Jan 12, 2021

will fix soon

0reactions
olekristensencommented, Nov 28, 2022

Hi there - is there a timeframe before this is merged? Any help still needed?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I interpret and format timestamps in a specific timezone?
Timestamps are assumed to be UTC, or Universal Time Code, and therefore timezone independent. If you need to parse a timestamp with an...
Read more >
Parser.parse changes to wrong time zone - Stack Overflow
I parsed the input using re and changed it from: Tue May 01 2018 13:23:00 GMT+0200 (CEST) to Tue May 01 2018 13:23:00...
Read more >
Chapter 3. Configuring the Date and Time
This displays the local and universal time, the currently used time zone, the status of the Network Time Protocol ( NTP ) configuration,...
Read more >
Telegraf 1.24 release notes - InfluxData Documentation
Update go.mongodb.org/mongo-driver from 1.10.1 to 1.10.2. ... MQTT Consumer input plugin ( inputs.mqtt_consumer ): Topic parsing error when topic having ...
Read more >
Apache Avro™ 1.10.2 Specification
Schema Resolution; Parsing Canonical Form for Schemas ... Since the compatibility of two schemas depends on both the data and the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found