Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTimeParse.Parse lacks full ISO8601 support #9364

Open
crozone opened this issue Dec 1, 2017 · 9 comments
Open

DateTimeParse.Parse lacks full ISO8601 support #9364

crozone opened this issue Dec 1, 2017 · 9 comments
Labels
area-System.DateTime enhancement Product code improvement that does NOT require public API changes/additions
Milestone

Comments

@crozone
Copy link

crozone commented Dec 1, 2017

DateTimeParse.Parse() (which powers DateTime.Parse() and DateTimeOffset.Parse()) currently only partially supports the ISO8601 standard. ISO8601 is heavily used in industry and having greater support for it significantly increases the usability of the DateTime.Parse methods.

Currently, the bits of ISO8601 that are supported are:

  • Sortable date/time pattern ("s"). 2009-06-15T13:45:30 = ISO8601 without timezone.

  • Round-trip date/time pattern. ("O"/"o"). 2009-06-15T13:45:30.0000000-07:00 = ISO 8601 with timezone offset.

Notable formats that are currently omitted:

  • Dates, Times, or DateTimes without dash or colon separators: 20171201, 123031, 20090615T134530+1100

  • Datetimes that have a decimal fraction added to the lowest order time element when it isn't seconds:
    2009-06-15T13:45.5 or 2009-06-15T13.5

  • Week notation (with day): 2017-W48 or 2017-W48-4

  • Ordinal date notation: 2017-001 - 2017-334

  • Yearless date notation: --10-31, --1031.

  • Times that use a comma (',') as a decimal separator for the lowest time element. ISO8601 universally allows the use of both a comma (',') or a period ('.') as a decimal separator, independent of current culture. Currently, only a period ('.') is supported, regardless of the CultureInfo.NumberFormat.NumberDecimalSeparator provided (although both should be allowed irrespective of culture).

@mburbea
Copy link

mburbea commented Dec 1, 2017

Also of note is lacking support for 24:00:00. Which is an alternative form of midnight.
E.g. 2009-06-15T24:00:00Z currently throws an exception.

@msftgits msftgits transferred this issue from dotnet/coreclr Jan 31, 2020
@msftgits msftgits added this to the Future milestone Jan 31, 2020
@maryamariyan maryamariyan added the untriaged New issue has not been triaged by the area owner label Feb 26, 2020
@joperezr joperezr removed the untriaged New issue has not been triaged by the area owner label Jul 1, 2020
@niemyjski
Copy link

+1

1 similar comment
@BellBat
Copy link

BellBat commented May 19, 2023

+1

@danmoseley
Copy link
Member

for folks doing +1 .. it would probably be helpful if you could describe your use cases.

@niemyjski
Copy link

Our use case is to support the spec and to have interop with external systems.

@danmoseley
Copy link
Member

What sorts of systems? (Completely appreciate what you're saying, but for proposals like this, it's about pulling together supporting data.)

@niemyjski
Copy link

I handle importing data from many third-party systems as well as listening to internal systems via kafka where we handle short dates (time only). A lot of educational type systems use the prefixes as mentioned above. In other apps you can have date-based invoices. The more support for the standard the better!

@TonyValenti
Copy link

I could really use this. I interact with a lot of JSON APIs and I'm running into a lot of issues interacting with Python APIs that use proper DateTimeOffset values.

@eiriktsarpalis
Copy link
Member

eiriktsarpalis commented Nov 30, 2023

If this gets implemented, the corresponding implementations in the Utf8Parser, IParsable<T> and IUtf8SpanParsable<T> should be updated as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.DateTime enhancement Product code improvement that does NOT require public API changes/additions
Projects
None yet
Development

No branches or pull requests