mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-01-04 15:51:51 +00:00
fix(sqlx-core): allow time::OffsetDateTime to be built from sqlite's CURRENT_TIMESTAMP (#2285)
SQLite's CURRENT_TIMESTAMP keyword fills a DATETIME column as a UTC expressed string in the following format: "YYYY-MM-DD HH:MM:SS". Unfortunately, this format lacks the timezone information to safely build a time::OffsetDateTime. If all else fails, this patch will try to build it by assuming the missing timezine is UTC.
This commit is contained in:
parent
4f1ac1d606
commit
dc9e298bff
@ -145,6 +145,10 @@ fn decode_offset_datetime_from_text(value: &str) -> Option<OffsetDateTime> {
|
||||
return Some(dt);
|
||||
}
|
||||
|
||||
if let Some(dt) = decode_datetime_from_text(value) {
|
||||
return Some(dt.assume_utc());
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user