Skip to content

Parse 2-digit year #459

Closed Answered by jhpratt
malthe asked this question in Question
Apr 14, 2022 · 1 comments · 9 replies
Discussion options

You must be logged in to vote

So it's not quite as simple as it could be, admittedly. I need to add a method that would permit easier manual control over values.

For now, you'll have to go through the Parsed struct yourself. You can do this by using Parsed::parse_items, which returns the raw Parsed instead of the final value. You can then modify this (in your cast using .year_last_two() and .set_year()/.with_year(). Once you've done that, you can call .try_into() or OffsetDateTime::try_from(val).

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@malthe
Comment options

@jhpratt
Comment options

@malthe
Comment options

@jhpratt
Comment options

@malthe
Comment options

Answer selected by malthe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants