Skip to content

Commit 5905846

Browse files
committed
Add test for issue 651
1 parent f45eb3c commit 5905846

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/datetime/tests.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,17 @@ fn test_datetime_from_timestamp_millis() {
12651265
);
12661266
}
12671267

1268+
#[test]
1269+
#[cfg(feature = "clock")]
1270+
fn test_datetime_before_windows_api_limits() {
1271+
// dt corresponds to `FILETIME = 147221225472` from issue 651.
1272+
// This used to fail on Windows for timezones with an offset of -5:00 or greater.
1273+
// The API limits years to 1601..=30827.
1274+
let dt = NaiveDate::from_ymd_opt(1601, 1, 1).unwrap().and_hms_milli_opt(4, 5, 22, 122).unwrap();
1275+
let local_dt = Local.from_utc_datetime(&dt);
1276+
dbg!(local_dt);
1277+
}
1278+
12681279
#[test]
12691280
#[cfg(feature = "clock")]
12701281
fn test_years_elapsed() {

0 commit comments

Comments
 (0)