[Unicode]   Common Locale Data Repository : Bug Tracking Home | Site Map | Search

CLDR Ticket #6771(closed: fixed)

Opened 5 years ago

Last modified 4 years ago

some locales need to display 24:00 for midnight, but 0:XX for the hour after midnight

Reported by: davinci@… Owned by: mark
Component: xxx-spec Data Locale:
Phase: final Review: pedberg
Weeks: Data Xpath:


In CLDR/ICU, there are four hour styles available:

h 1-12
K 0-11

k 1-24
H 0-23

For style "k", minutes in the hour between midnight and 1 am are displayed as 24:00, 24:01, ..., 24:59, 1:00, for example. However, there does not appear to be any locale actually using this style:

However, there are locales which labels the hour as 24 just when the minutes are 00, but as hour 0 otherwise: 24:00, 0:01, ..., 0:59, 1:00.

Countries which use this style include: CS, ES, FI, and HU.


Change History

comment:1 Changed 5 years ago by davinci@…

Also, whether "0:00" or "24:00" may depend on whether midnight is the end of an interval.

For example, Hungarian displays "open 24 hours" as "0:00-24:00".

comment:2 Changed 5 years ago by mark

This is a tricky issue: ICU and most other packages divide time into days. Each day starts at 0 and ends at 23:59:59.99999... (where the exact upper limit depends on the units). 24:00 is the same as 0, except that it is at the end of the day rather than at the start. That is, 24:00 Monday is the same as 0:00 Tuesday.

Midnight is odd as well. Supposed it is Tuesday. I could say "I woke up at midnight this morning, and couldn't get to sleep until 3". In that case, midnight means 0:00 Tuesday. But if I said: "So I'm sorry I can't say late tonight: I have to leave by midnight". In that case, I mean 24:00 Tuesday.

If we simply reformatted "Monday Oct 28 at 0:00" as "Monday Oct 28 at 24:00" it wouldn't work, since that would be interpreted as 24 hours later than the actual time it was meant to represent. However, what should work is that "Tuesday Oct 28 at 0:00" minus 1 millisecond would be formatted as "Monday Oct 28 at 24:00". That is, we would show the following rounded times:

Monday, HH		+ 23.5		as 24 Monday
Monday, HH:mm	+ 23:59.5		as 24:00 Monday
Monday, HH:mm:ss	+ 23:59:59.5	as 24:00:00 Monday

If we parsed "24:00" we'd want the same to work; that is, the value should round-trip.


  • Do we reinterpret 'k' to have this meaning?
  • It might be tricky to implement, depending on how calendar works. That is, if calendar truncates in order to separate out a date and time from a datetime, it would be straightforward. If it rounds, it would be trick. I suspect it truncates, but we'd have to check.

comment:3 Changed 5 years ago by emmons

  • Owner changed from anybody to mark
  • Status changed from new to assigned
  • type changed from unknown to enhancement
  • Component changed from unknown to design
  • Milestone changed from UNSCH to 25rc

comment:4 Changed 5 years ago by mark

What I propose that we do is to specify that in each day, 86,399.999 seconds up to but not including 86,400 seconds is formatted as 24:00:00 or the equivalent. That way if you wanted to format

The office closes on {DATE} at {TIME}.

You would use DATETIME = max(inputTime, 86,399.999).

We can automatically do this in date intervals, but we also need a way to do it in isolated date formatting.

comment:5 Changed 5 years ago by davinci@…

SGTM. Are there any issues with precision/rounding errors?

comment:6 Changed 5 years ago by emmons

  • Status changed from assigned to design
  • Milestone changed from 25rc to 26dsub

comment:7 Changed 5 years ago by mark

  • Milestone changed from 26dsub to 27

comment:8 Changed 4 years ago by markus

  • Phase set to final

comment:9 Changed 4 years ago by mark

  • Component changed from design to unknown

Move component=design to status=design

comment:10 Changed 4 years ago by mark

  • Component changed from unknown to spec

Suggest that we:

document that implementations may use formatting like Tuesday, 11:00 — 25:00 by providing an API option to have a maximum hour of some value ≥ 24, so Wednesday, Aug 5 at 01:00 turns into Tuesday Aug 4 at 25:00

comment:11 Changed 4 years ago by mark

  • Status changed from design to accepted
  • Review set to pedberg

comment:12 Changed 4 years ago by mark

  • Status changed from accepted to reviewing

comment:13 Changed 4 years ago by pedberg

  • Status changed from reviewing to closed
  • Resolution set to fixed

Add a comment

Modify Ticket

as closed
Next status will be 'new'
Next status will be 'closed'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.