notesy::time

The time: now, written in the user's time zone, read from a date, and how long ago something was. Needs nothing.

rustuse notesy::{log, store, time};

pub fn ready() {
    let now = time::now();
    log::info(`It's ${time::format(now, "%H:%M")}`);
    if let Some(at) = store::get("synced") {
        log::info(`Synced ${time::ago(at)}`);
    }
    store::set("synced", now);
    let due = time::parse("2026-09-30").unwrap_or(0);
    log::info(`${(due - now) / 86400} days to go`);
}
Function What it does
time::now() Seconds since 1 January 1970 (UTC), now.
time::format(secs, pattern) secs written in the user's time zone with a strftime pattern: %Y-%m-%d, %H:%M, %a for the day's short name … An empty or broken pattern writes it as ISO 8601, in UTC.
time::parse(text) Seconds for a date as front matter writes one: 2026-09-14, maybe with a time (2026-09-14T15:00, :30 for seconds) and a Z or +01:00. Without an offset it counts as UTC, so a date's day and hour read back with plain arithmetic (secs % 86400 / 3600 is its hour). None for text that isn't a date.
time::ago(secs) How long ago that was, as notesy says it: just now, 5 minutes ago, yesterday, 3 days ago, then the date.

Every page