mirror of
https://github.com/launchbadge/sqlx
synced 2024-09-20 14:21:57 +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
1 changed files with 4 additions and 0 deletions
|
@ -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…
Reference in a new issue