expressive/time.rs
1use crate::{Result, Value};
2
3use chrono::{Days, Utc};
4
5pub fn now() -> Result<Value> {
6 let now = Utc::now().time().to_string();
7
8 Ok(Value::String(now))
9}
10
11pub fn today() -> Result<Value> {
12 let today = Utc::now().date_naive().to_string();
13
14 Ok(Value::String(today))
15}
16
17pub fn tomorrow() -> Result<Value> {
18 let tomorrow = Utc::now()
19 .checked_add_days(Days::new(1))
20 .unwrap()
21 .date_naive()
22 .to_string();
23
24 Ok(Value::String(tomorrow))
25}