mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-23 10:38:57 +00:00
Sqlite chrono::DateTime<FixedOffset> timezone fix (#1618)
This commit is contained in:
@@ -94,16 +94,16 @@ mod chrono {
|
||||
use super::*;
|
||||
use sqlx::types::chrono::{DateTime, FixedOffset, NaiveDate, NaiveDateTime, TimeZone, Utc};
|
||||
|
||||
test_type!(chrono_naive_date_time<NaiveDateTime>(Sqlite,
|
||||
"datetime('2019-01-02 05:10:20')" == NaiveDate::from_ymd(2019, 1, 2).and_hms(5, 10, 20)
|
||||
test_type!(chrono_naive_date_time<NaiveDateTime>(Sqlite, "SELECT datetime({0}) is datetime(?), {0}, ?",
|
||||
"'2019-01-02 05:10:20'" == NaiveDate::from_ymd(2019, 1, 2).and_hms(5, 10, 20)
|
||||
));
|
||||
|
||||
test_type!(chrono_date_time_utc<DateTime::<Utc>>(Sqlite,
|
||||
"datetime('1996-12-20T00:39:57+00:00')" == Utc.ymd(1996, 12, 20).and_hms(0, 39, 57)
|
||||
test_type!(chrono_date_time_utc<DateTime::<Utc>>(Sqlite, "SELECT datetime({0}) is datetime(?), {0}, ?",
|
||||
"'1996-12-20T00:39:57+00:00'" == Utc.ymd(1996, 12, 20).and_hms(0, 39, 57)
|
||||
));
|
||||
|
||||
test_type!(chrono_date_time_fixed_offset<DateTime::<FixedOffset>>(Sqlite,
|
||||
"datetime('2016-11-08T03:50:23-05:00')" == FixedOffset::west(5 * 3600).ymd(2016, 11, 08).and_hms(3, 50, 23)
|
||||
test_type!(chrono_date_time_fixed_offset<DateTime::<FixedOffset>>(Sqlite, "SELECT datetime({0}) is datetime(?), {0}, ?",
|
||||
"'2016-11-08T03:50:23-05:00'" == DateTime::<Utc>::from(FixedOffset::west(5 * 3600).ymd(2016, 11, 08).and_hms(3, 50, 23))
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user