lemmy/crates/utils/src/utils/time.rs
phiresky 514f2222e0
Fix time zone handling (#3496)
* convert naive time to utc time

* compounding fixes

* cargo fmt

* fix the rest

* fix down migration

* fix migrations

* fix after merge

* clippy fix

* ap-fed 0.5.0

---------

Co-authored-by: Nutomic <me@nutomic.com>
2023-08-24 11:27:00 -04:00

13 lines
257 B
Rust

use chrono::{DateTime, TimeZone, Utc};
pub fn naive_from_unix(time: i64) -> DateTime<Utc> {
Utc
.timestamp_opt(time, 0)
.single()
.expect("convert datetime")
}
pub fn convert_datetime(datetime: DateTime<Utc>) -> DateTime<Utc> {
datetime
}