synd_term/types/
time.rs

1pub type Time = synd_feed::types::Time;
2
3pub trait TimeExt {
4    fn local_ymd(&self) -> String;
5    fn local_ymd_hm(&self) -> String;
6}
7
8#[cfg(feature = "integration")]
9impl TimeExt for Time {
10    fn local_ymd(&self) -> String {
11        self.format("%Y-%m-%d").to_string()
12    }
13
14    fn local_ymd_hm(&self) -> String {
15        self.format("%Y-%m-%d %H:%M (%:z)").to_string()
16    }
17}
18
19#[cfg(not(feature = "integration"))]
20impl TimeExt for Time {
21    fn local_ymd(&self) -> String {
22        self.with_timezone(&chrono::Local)
23            .format("%Y-%m-%d")
24            .to_string()
25    }
26
27    fn local_ymd_hm(&self) -> String {
28        self.with_timezone(&chrono::Local)
29            .format("%Y-%m-%d %H:%M (%:z)")
30            .to_string()
31    }
32}