datetime_iso8601
Types
An ISO8601 date-time. This format is very complex! You should use the
RFC3339 format instead, unless you need the more niche formats such
as 2024-W11-5.
Complete dates (calendar, ordinal, week) can have an optional time component. Reduced precision dates (year-only, month-only, week-only) cannot have times.
pub type DateTime {
CalendarDate(
year: Int,
month: calendar.Month,
day: Int,
time: option.Option(Time),
)
CalendarMonthDate(year: Int, month: calendar.Month)
CalendarYearDate(year: Int)
OrdinalDate(
year: Int,
day_of_year: Int,
time: option.Option(Time),
)
WeekDate(
year: Int,
week: Int,
day_of_week: DayOfWeek,
time: option.Option(Time),
)
YearWeek(year: Int, week: Int)
}
Constructors
-
CalendarDate( year: Int, month: calendar.Month, day: Int, time: option.Option(Time), )A calendar date with optional time component.
Examples
2024-03-15 20240315 2024-03-15T14:30:00Z 2024-03-15T14:30:00+05:30 -
CalendarMonthDate(year: Int, month: calendar.Month)A calendar date with month precision (no day).
Examples
2024-03 -
CalendarYearDate(year: Int)A calendar date with year precision only.
Examples
2024 -
OrdinalDate( year: Int, day_of_year: Int, time: option.Option(Time), )An ordinal date (year and day of year) with optional time component.
Examples
2024-075 2024075 2024-075T14:30:00Z -
WeekDate( year: Int, week: Int, day_of_week: DayOfWeek, time: option.Option(Time), )A week date (year, week, and day of week) with optional time component.
Examples
2024-W11-5 2024W115 2024-W11-5T14:30:00Z -
YearWeek(year: Int, week: Int)A week date with week precision (no day of week).
Examples
2024-W11 2024W11
A day of the week, where Monday is 1 and Sunday is 7.
pub type DayOfWeek {
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
}
Constructors
-
Monday -
Tuesday -
Wednesday -
Thursday -
Friday -
Saturday -
Sunday
Time of day with varying precision Nanosecond represents the fractional part of the smallest unit Timezone is None for naive times
pub type Time {
TimeSecond(
hour: Int,
minute: Int,
second: Int,
nanosecond: option.Option(Int),
timezone: option.Option(Timezone),
)
TimeMinute(
hour: Int,
minute: Int,
nanosecond: option.Option(Int),
timezone: option.Option(Timezone),
)
TimeHour(
hour: Int,
nanosecond: option.Option(Int),
timezone: option.Option(Timezone),
)
}
Constructors
-
TimeSecond( hour: Int, minute: Int, second: Int, nanosecond: option.Option(Int), timezone: option.Option(Timezone), )A time of day with fractional second precision.
Examples
14:30:00 143000 14:30:00Z 14:30:00.123 14:30:00+05:30 -
TimeMinute( hour: Int, minute: Int, nanosecond: option.Option(Int), timezone: option.Option(Timezone), )A time of day with fractional minute precision.
Examples
14:30 1430 14:30Z 14:30.5 14:30+05:30 -
TimeHour( hour: Int, nanosecond: option.Option(Int), timezone: option.Option(Timezone), )A time of day with fractional hour precision.
Examples
14 14Z 14.5 14+05:30