m3e/ymd

Types

Ymd is a date only consisting of year, month, and day.

pub opaque type Ymd

Values

pub const default: Ymd
pub fn from_string(input: String) -> Result(Ymd, String)

from_string parses a Ymd value from a string, returning a Result. The string must be in the format yyyy-mm-dd, with valid year, month, and day values.

pub fn new(
  year: Int,
  month: Int,
  day: Int,
) -> Result(Ymd, String)

new creates a Ymd value from year, month, and day integers, returning a Result. The year must be between 1800 and 2500, inclusive. The month must be between 1 and 12, inclusive. The day must be between 1 and the number of days in the given month and year, inclusive.

pub fn to_string(d: Ymd) -> String

to_string converts a Ymd value to a string in the format yyyy-mm-dd.

pub fn today_utc() -> Ymd

today_utc creates a Ymd (pure year-month-day) with today’s date

Search Document