ACR Rules

  1. Home
  2. Docs
  3. ACR Rules
  4. Reliability (41)
  5. Hour format should be specified correctly in parse/format date-time functions

Hour format should be specified correctly in parse/format date-time functions

Released in version 1.5 (14 February 2020)

This is likely a bug and should be fixed.
“H” is in the range 0-23; “h” is in the range 1-12, as expected. On the other hand, “K” is in the range 0-11 but “k” is in the range “1-24”, which is non-standard and should be avoided.

“h” is usually used singly (rather than requiring exactly two digits), and always in conjunction with an AM/PM specifier – as otherwise, it’s ambiguous. “H” is usually used as “HH”, so that 5am is represented as β€œ05” for example.

Noncompliant example:

parseDateTime('13:37', 'hh:mm')

Compliant example:

parseDateTime('13:37', 'HH:mm')