diff --git a/diesel/src/pg/types/date_and_time/chrono.rs b/diesel/src/pg/types/date_and_time/chrono.rs index 6dc9bef95485..a19b871286f2 100644 --- a/diesel/src/pg/types/date_and_time/chrono.rs +++ b/diesel/src/pg/types/date_and_time/chrono.rs @@ -280,8 +280,8 @@ mod tests { let query = select(sql::("'J0'::date").eq(julian_epoch)); assert!(query.get_result::(connection).unwrap()); - let max_date = NaiveDate::MAX; - let query = select(sql::("'262143-12-31'::date").eq(max_date)); + let max_date = NaiveDate::from_ymd_opt(262142, 12, 31).unwrap(); + let query = select(sql::("'262142-12-31'::date").eq(max_date)); assert!(query.get_result::(connection).unwrap()); let january_first_2018 = NaiveDate::from_ymd_opt(2018, 1, 1).unwrap(); @@ -311,8 +311,8 @@ mod tests { let query = select(sql::("'J0'::date")); assert_eq!(Ok(julian_epoch), query.get_result::(connection)); - let max_date = NaiveDate::MAX; - let query = select(sql::("'262143-12-31'::date")); + let max_date = NaiveDate::from_ymd_opt(262142, 12, 31).unwrap(); + let query = select(sql::("'262142-12-31'::date")); assert_eq!(Ok(max_date), query.get_result::(connection)); let january_first_2018 = NaiveDate::from_ymd_opt(2018, 1, 1).unwrap();