You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand; however to return a %Date{} we also need a month and day, so assumptions have to be made. The way to provide these assumptions is via assume_date:
The above example won't work yet, as you point out, until 4-digit integers are guessed as a year. In your code, you'd want to check if the year is 0000 and consider that an error since that's probably not what you want.
Perhaps if there's a community need, more functions could be made available to parse_year, parse_day, parse_month etc so it's not constrained to the a Date struct.
I'm using this library to parse csv provided by users and there is a lot of weird input going on.
Suprisingly it's handled very well and I just found this somewhere in the logs. (our logic checks then for very old dates - that's how I catched it)
So adding parse_year would require custom logic to handle this case.
I think that the shorter numbers should be parsed as year and can default to 1 January
Imo it's more likely that it's the current year than 1905.
The text was updated successfully, but these errors were encountered: