Closed snspinn closed 9 months ago
Is the repr:last_two year component formatting option removed from latest? I'm manipulating a string in the form of "YYMMDDmm" into OffsetDateTime.
repr:last_two
I've found that the following input and description work when passed into OffsetDateTime::parse():
input
description
OffsetDateTime::parse()
let input = format!("20{}00 +00:00:00",date_time_period); let description = format_description!("[year][month repr:numerical][day][hour repr:24][minute][second] \ [offset_hour sign:mandatory]:[offset_minute]:[offset_second]");
But these inputs are failing with a TryFromParsed(InsufficientInformation):
TryFromParsed(InsufficientInformation)
let input = format!("{}00 +00:00:00",date_time_period); let description = format_description!("[year repr:last_two][month repr:numerical][day][hour repr:24][minute][second] \ [offset_hour `sign:mandatory]:[offset_minute]:[offset_second]");
If I print out the input and description in the failing case, I get the following (suggesting it should work):
"230909220000 +00:00:00" [Year(Year { padding: Zero, repr: LastTwo, iso_week_based: false, sign_is_mandatory: false }), Month(Month { padding: Zero, repr: Numerical, case_sensitive: true }), Day(Day { padding: Zero }), Hour(Hour { padding: Zero, is_12_hour_clock: false }), Minute(Minute { padding: Zero }), Second(Second { padding: Zero }), , OffsetHour(OffsetHour { sign_is_mandatory: true, padding: Zero }), :, OffsetMinute(OffsetMinute { padding: Zero }), :, OffsetSecond(OffsetSecond { padding: Zero })]
rustc 1.75.0 (82e1608df 2023-12-21) time = { version = "0.3.34", features = ["macros", "parsing"] }
rustc 1.75.0 (82e1608df 2023-12-21)
time = { version = "0.3.34", features = ["macros", "parsing"] }
It was not removed; it was never supported. See #649 for details.
Is the
repr:last_two
year component formatting option removed from latest? I'm manipulating a string in the form of "YYMMDDmm" into OffsetDateTime.I've found that the following
input
anddescription
work when passed intoOffsetDateTime::parse()
:But these inputs are failing with a
TryFromParsed(InsufficientInformation)
:If I print out the
input
anddescription
in the failing case, I get the following (suggesting it should work):Versions
rustc 1.75.0 (82e1608df 2023-12-21)
time = { version = "0.3.34", features = ["macros", "parsing"] }