chrono icon indicating copy to clipboard operation
chrono copied to clipboard

Parsing from string to DateTime - input is not enough for unique date and time

Open AustinHellerRepo opened this issue 1 year ago • 3 comments

When trying to parse the date/time "Sun, 28 Apr 2024 11:05:00 GMT" with "%a, %d %b %Y %H:%M:%S %Z" it claims that there is not enough information. Is there something wrong with my format or understanding of the process?

Rust playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=fa3d8c9d12107f73fa2eff695f98ab9e

AustinHellerRepo avatar Apr 27 '24 20:04 AustinHellerRepo

This is an unfortunate limitation that is not fixed yet, see #38. Do the comments in #1321, #1422 or #1542 help?

pitdicker avatar Apr 28 '24 11:04 pitdicker

Thanks for the links. It looks like the issue is that it can be ambiguous, the timezone abbreviation. What are your thoughts on implementing the common timezones and producing a helpful error like "timezone not implemented"?

AustinHellerRepo avatar Apr 28 '24 15:04 AustinHellerRepo

What are your thoughts on implementing the common timezones and producing a helpful error like "timezone not implemented"?

It is on my wishlist :smile:. We would need to come up with some criteria for inclusion. Two criteria I think are reasonable is that the abbreviation should be used in the IANA time zone database and that it should be in use currently (not historical). Then the subjective part of what is common... but that may turn out not be too difficult to come up with.

pitdicker avatar Apr 28 '24 15:04 pitdicker