1
0

Fix gallery date display (#445)

* Fix gallery date display

* Fix approved date not setting
This commit is contained in:
Geometrically
2022-09-04 13:37:11 -07:00
committed by GitHub
parent e7c3f8bf47
commit b25af641e2
4 changed files with 28 additions and 15 deletions

View File

@@ -121,7 +121,13 @@ impl ids::ProjectTypeId {
}
pub fn convert_postgres_date(input: &str) -> DateTime<Utc> {
DateTime::parse_from_str(input, "%Y-%m-%d %T%#z")
let mut result = DateTime::parse_from_str(input, "%Y-%m-%d %T.%f%#z");
if result.is_err() {
result = DateTime::parse_from_str(input, "%Y-%m-%d %T%#z")
}
result
.map(|x| x.with_timezone(&Utc))
.unwrap_or_else(|_| Utc::now())
}