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.

Wrong date calculation in certain chrome version after using setZone()

See original GitHub issue
    var isoString = "2019-10-10T10:00:00.000Z";
    var start = DateTime.fromISO(isoString);
    
    for (var i = 0; i < 24; i++) {
        var nozone = start.plus( Duration.fromObject({ hours: i }));
        var withZone = nozone.setZone("Asia/Beirut");
        console.log("iso nozone", nozone.toISODate(), nozone.toISOTime());
        console.log("iso withzone", withZone.toISODate(), withZone.toISOTime());
        console.log("nozone", nozone.day);
        console.log("withZone", withZone.day);
    }

you will notice the withZone day go from 10 -> 12 -> 11

around the record for the wrong date, the iso string goes from “iso withzone 2019-10-10 23:00:00.000+03:00” to “iso withzone 2019-10-12 00:00:00.000+27:00” to “iso withzone 2019-10-11 01:00:00.000+03:00”

in the browser versions that go wrong.

Doesn’t happen in Version 78.0.3904.97 (Official Build) (64-bit)

Does happen in: Version 80.0.3966.0 (Official Build) canary (64-bit) Version 80.0.3964.0 (Official Build) dev (64-bit) Version 80.0.3964.0 (Official Build) dev (32-bit)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
icambroncommented, Feb 7, 2020

The good folks at Google have informed me this is in fact according to spec. Which is means that basically the “workaround” is here to stay. Which is fine; it works.

1reaction
icambroncommented, Feb 7, 2020

@notlikethis1 It’s now in the main Chrome channel. I wrote this update because I’ve had an influx of new reports by devs who aren’t on the latest version of Luxon.

I’m also going to try out a slightly cleaner fix once I have a chance to test that it works on other browsers and supported Node versions

Read more comments on GitHub >

github_iconTop Results From Across the Web

The display of date formats in Google Chrome is incorrect for ...
Date formats displayed in the Staff UI are controlled by the date format settings in your browser. ... To ensure that Chrome is...
Read more >
luxon endOf month resolving wrong date - Stack Overflow
I think that issue showed in the linked CodeSandbox is due to old version of luxon used ( 1.2.0 ). You'll get the...
Read more >
Time Error in Chrome - Google Support
My PC's date, time and time zone are set automatically, and I have the latest version of Chrome installed. This only happens on...
Read more >
Add a Timezone to LocalDateTime with ZonedDateTime in ...
The LocalDateTime class introduced in Java 8 stores the date and time but not the timezone. So we need something else when developing ......
Read more >
@conpago/rrule - npm
JavaScript library for working with recurrence rules for calendar dates.. Latest version: 2.7.1, last published: 5 months ago. Start using @conpago/rrule in ...
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