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.

Unexpected 24-hour time format in en-AU

See original GitHub issue

In Australia (en-AU) a 24-hr time string to represent midnight is expected to be 00:00. However, 24:00 is returned.

For example the following returns ‘24:00’… DateTime.fromISO('00:00').toLocaleString({ ...DateTime.TIME_24_SIMPLE, locale: 'en-AU' });

whereas the following return ‘00:00’… DateTime.fromISO('00:00').toLocaleString({ ...DateTime.TIME_24_SIMPLE, locale: 'en-GB' });

As far as I’m aware Australia also commonly expresses midnight as 00:00 not 24:00.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
dlbasscommented, Jun 8, 2020

@icambron We have been ignoring complaints about this issue in our app for a while now, and just today decided to deal with it. After reading this thread, and then a bunch of fumbling through Unicode documentation we found this table (see Day Periods at the very bottom) showing that the ICU has the correct data. However, Chrome, Edge, and Android all display the incorrect 24:XX, while Firefox, Safari, and iOS display the expected 00:XX.

Your fix to add hourCycle: 'h23' solves the issue in Chrome and doesn’t appear to cause any issues with the browsers that already display the time correctly. That fix is also documented in the Google Chrome Help forum.

MDN describes the behavior we see in Chromium, but I don’t see the ICU data supporting Chromium’s choice to show h24 over h23.

We use Luxon a lot, and really hope to be able to leverage hourCycle to fix this time display. Regardless of what is correct for the locale, being able to show the time how we want would be very handy.

2reactions
icambroncommented, Mar 18, 2020

It’s something browser is doing. Luxon uses the Intl API, like in my first code snippet above. Then the browser uses its data, typically taken from ICU, to provide the strings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Time question in 12 hour format in feature report
The condition checks if the hours are less than 12, in which case make this an AM time; else subtract 12 to get...
Read more >
For Sale on eBay: A Military Database of Fingerprints and Iris ...
The shoebox-shaped device, designed to capture fingerprints and perform iris scans, was listed on eBay for $149.95.
Read more >
How do I set 24-hour mode? — Pocket Informant Help Center
Go to System Preferences->Language & Region and check the "24-hour" time. Was this article helpful?
Read more >
Solved: How do I Convert Time String (2:00 PM) to 24 hour
Unfortuantely I am using a Microsoft Form as the intial input for colleciton of flows, and selecting a time isn't possible the way...
Read more >
3 Ways to Convert from 24 Hour to 12 Hour Time - wikiHow
1. Add 12 to the first hour of the day and include “AM.” In 24-hour time, midnight is signified as 00:00. So, for...
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