Skip to content

Support 24:00 in hh:mm for ISO8601 dates #12197

@JamesNK

Description

@JamesNK

A time of 24:00 is a valid in ISO8601 dates.

Midnight is a special case and may be referred to as either "00:00" or "24:00". The notation "00:00" is used at the beginning of a calendar day and is the more frequently used. At the end of a day use "24:00". "2007-04-05T24:00" is the same instant as "2007-04-06T00:00" (see Combined date and time representations below).

https://en.wikipedia.org/wiki/ISO_8601

var dt = DateTimeOffset.Parse("2007-04-05T24:00");
var dt = DateTime.Parse("2007-04-05T24:00");
System.FormatException: 'The DateTime represented by the string '2007-04-05T24:00' is not supported in calendar 'System.Globalization.GregorianCalendar'.'
   at System.DateTimeParse.Parse(ReadOnlySpan`1 s, DateTimeFormatInfo dtfi, DateTimeStyles styles, TimeSpan& offset)
   at System.DateTimeOffset.Parse(String input)
   at ConsoleApp17.Program.Main(String[] args) in C:\Users\James\source\repos\ConsoleApp17\ConsoleApp17\Program.cs:line 10

Should be fixed in DateTimeOffset.Parse/DateTime.Parse and new Utf8Parser API.

Metadata

Metadata

Labels

area-System.DateTimeenhancementProduct code improvement that does NOT require public API changes/additionsin-prThere is an active PR which will close this issue when it is merged

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions