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.

Midnight showing up different between machines set to UTC

See original GitHub issue

I have the following function:

function formatTime(ms) {
  const dateTime = DateTime.fromMillis(ms)
  return dateTime.toLocaleString( DateTime.TIME_24_WITH_SHORT_OFFSET)
}

When I pass in 0 I see 00:00:00 UTC on my local machine. However, I see 24:00:00 UTC on my CI server.

I’ve configured my test suite to force a timezone of UTC, but one represents the midnight hour as 00 and the other as 24. Is there a way to force one or the other?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
koitsucommented, Jul 31, 2020

It’s almost certainly the locale. Try forcing the locale to the same thing, like setLocale("en-us")

It isn’t the locale. There is a deeper bug with TZ support when it comes to negative TZ offsets. Please see #733 for an example.

0reactions
GillesDebunnecommented, Aug 17, 2020

I’m closing this bug as a duplicate of #726. Please post your comments there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Handle Timezones and Synchronize Your Software ...
In this test, the goal is to check that setHours sets the date's hours and minutes to zero (midnight). I first choose a...
Read more >
c# get midnight time of specific timezone in UTC
In above example I enter midnight time in +05:30 and it give UTCtime for it. Note: I am resetting my machine timezone to...
Read more >
What Is UTC, and How Is It Used? - MakeUseOf
It's used as the primary time measurement by pilots—since they change time zones so quickly, referring to everything in UTC is less confusing....
Read more >
How to convert UTC time to local time - Microsoft Support
Describes how to convert UTC time to local time. You can use the method that is described in this article to compare a...
Read more >
Time & date: Essential concepts - W3C
Java (and many other systems) count time as the number of milliseconds since midnight (00:00 a.m.) on January 1, 1970 in UTC (less...
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