Skip to content

Commit a58433f

Browse files
committed
Do not use deprecated chrono functions anymore
1 parent ab60ce1 commit a58433f

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

tests/type_check.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ async fn test_timestamp() {
161161
type_check::<_, sql_types::Timestamp>(
162162
conn,
163163
chrono::NaiveDateTime::new(
164-
chrono::NaiveDate::from_ymd(2021, 09, 27),
165-
chrono::NaiveTime::from_hms_milli(17, 44, 23, 0),
164+
chrono::NaiveDate::from_ymd_opt(2021, 09, 27).unwrap(),
165+
chrono::NaiveTime::from_hms_milli_opt(17, 44, 23, 0).unwrap(),
166166
),
167167
)
168168
.await;
@@ -171,13 +171,18 @@ async fn test_timestamp() {
171171
#[tokio::test]
172172
async fn test_date() {
173173
let conn = &mut connection().await;
174-
type_check::<_, sql_types::Date>(conn, chrono::NaiveDate::from_ymd(2021, 09, 27)).await;
174+
type_check::<_, sql_types::Date>(conn, chrono::NaiveDate::from_ymd_opt(2021, 09, 27).unwrap())
175+
.await;
175176
}
176177

177178
#[tokio::test]
178179
async fn test_time() {
179180
let conn = &mut connection().await;
180-
type_check::<_, sql_types::Time>(conn, chrono::NaiveTime::from_hms_milli(17, 44, 23, 0)).await;
181+
type_check::<_, sql_types::Time>(
182+
conn,
183+
chrono::NaiveTime::from_hms_milli_opt(17, 44, 23, 0).unwrap(),
184+
)
185+
.await;
181186
}
182187

183188
#[cfg(feature = "mysql")]
@@ -187,8 +192,8 @@ async fn test_datetime() {
187192
type_check::<_, sql_types::Datetime>(
188193
conn,
189194
chrono::NaiveDateTime::new(
190-
chrono::NaiveDate::from_ymd(2021, 09, 30),
191-
chrono::NaiveTime::from_hms_milli(12, 06, 42, 0),
195+
chrono::NaiveDate::from_ymd_opt(2021, 09, 30).unwrap(),
196+
chrono::NaiveTime::from_hms_milli_opt(12, 06, 42, 0).unwrap(),
192197
),
193198
)
194199
.await;

0 commit comments

Comments
 (0)