m3e/date

Types

Date represents a date value, optionally with a time and timezone. Aligning with Material Expressive’s subset of the ISO 8601 standard, Date supprts the following string formats:

  • yyyy-MM-dd,
  • yyyy-MM-ddTHH:mm:ss,
  • yyyy-MM-ddTHH:mm:ssZ,
  • yyyy-MM-ddTHH:mm:ss±HH:mm.
pub opaque type Date

Values

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

from_string parses a string into a DateTime value.

pub fn new(
  d: ymd.Ymd,
  t: option.Option(time.Time),
  tz: option.Option(timezone.TimeZone),
) -> Date

new creates a Date value from a Ymd, Time, and TimeZone.

pub fn to_string(d: Date) -> String

to_string converts a Date value to a string in the format yyyy-MM-dd or yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:ssZ or yyyy-MM-ddTHH:mm:ss±HH:mm.

pub fn today_utc() -> Date

today_utc creates a Date (pure year-month-day form) with today’s date in UTC (i.e. no timezone)

Search Document