Create a context from the current UTC time.
(counter: i64, tenant: &'a str, session_vars: &'a HashMap<String, String>)
| 165 | impl<'a> FormatContext<'a> { |
| 166 | /// Create a context from the current UTC time. |
| 167 | pub fn now(counter: i64, tenant: &'a str, session_vars: &'a HashMap<String, String>) -> Self { |
| 168 | let dt = nodedb_types::NdbDateTime::now(); |
| 169 | let c = dt.components(); |
| 170 | Self { |
| 171 | counter, |
| 172 | year: c.year as u16, |
| 173 | month: c.month, |
| 174 | day: c.day, |
| 175 | quarter: ((c.month - 1) / 3) + 1, |
| 176 | iso_week: iso_week_number(c.year, c.month, c.day), |
| 177 | tenant, |
| 178 | session_vars, |
| 179 | } |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | /// Compute ISO 8601 week number (1–53). |
no test coverage detected