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
let naivedatetime = NaiveDate::from_ymd_opt(1900, 1, 1)
.unwrap().and_hms_opt(0, 0, 0)
.unwrap();
let datetime_from_utc = Local.from_utc_datetime(&naivedatetime);
let datetime_from_local = Local.from_local_datetime(&naivedatetime).unwrap();
But changing of the first line to
let naivedatetime = NaiveDate::from_ymd_opt(1898, 1, 1)
.unwrap().and_hms_opt(0, 0, 0)
.unwrap();
causes a panic: thread 'datetime::tests::test_from_naive_date_time_conversions' panicked at 'attempt to subtract with overflow', src\offset\local\windows.rs:223:18
I face this problem on Windows only. So what range of datetime should be supported by functions Local.from_utc_datetime and Local.from_local_datetime on Windows?
The text was updated successfully, but these errors were encountered:
This looks like a bug. Assuming you're on 0.4.x, the code says:
tm_year: d.year() - 1900,// this doesn't underflow, we know that d is `NaiveDateTime`.
Which indicates the comment is clearly wrong? This code seems to be using a struct Tm which restricts tm_year to "Years since 1900" which seems just a silly limitation. The Microsoft documentation for the SYSTEMTIME suggests that its wYear supports values "from 1601 through 30827".
So the Windows code here seems pretty broken. Would you be interested in helping to fix it? That would be great.
Code like this works fine:
But changing of the first line to
causes a panic:
thread 'datetime::tests::test_from_naive_date_time_conversions' panicked at 'attempt to subtract with overflow', src\offset\local\windows.rs:223:18
I face this problem on Windows only. So what range of datetime should be supported by functions
Local.from_utc_datetime
andLocal.from_local_datetime
on Windows?The text was updated successfully, but these errors were encountered: