From d3be65b0fcf7f80113268ff6435e9c802fa456cc Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Wed, 19 Apr 2023 07:26:38 +0200 Subject: [PATCH] Add test for issue 651 --- src/datetime/tests.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/datetime/tests.rs b/src/datetime/tests.rs index 8e1877c50e..febc416d54 100644 --- a/src/datetime/tests.rs +++ b/src/datetime/tests.rs @@ -857,6 +857,15 @@ fn test_datetime_from_local() { assert_eq!(datetime_west, datetime_utc.with_timezone(&timezone_west)); } +#[test] +fn test_issue_651() { + // dt corresponds to `FILETIME = 147221225472` from the issue. + // This used to fail on Windows for timezones with an offset of -5:00 or greater. + let dt = NaiveDate::from_ymd_opt(1601, 1, 1).unwrap().and_hms_milli_opt(4, 5, 22, 122).unwrap(); + let local_dt = Local.from_utc_datetime(&dt); + dbg!(local_dt); +} + #[test] #[cfg(feature = "clock")] fn test_years_elapsed() {