Skip to content

module

time

Time periods as statistics publish them: 2021, 2023-Q1, 2023-M03, 2023-03, 2023-03-15, Mar-2023 and financial years (2022-23), read as decimal years so an axis spaces them truly.

Functions

date_of

pub fn date_of(t: f64) -> (i64, usize, u32)

A decimal year back to (year, month, day).

is_time_name

pub fn is_time_name(key: &str) -> bool

Whether a column name says it holds times (so bare years count).

period

pub fn period(s: &str) -> Option<f64>

One period as a decimal year. 2010-11 reads as November 2010 here: use periods for a whole column, which can tell financial years.

periods

pub fn periods<'a>(values: impl IntoIterator<Item = &'a str>) -> Vec<Option<f64>>

A column of periods. 2010-11, 2011-12 could be months, so they're financial years only when every value in the column could be one.

year_of

pub fn year_of(y: i64, m: usize, d: u32) -> Option<f64>

(year, month, day) as a decimal year.