tempo
Types
pub type Date {
Date(year: Int, month: Month, day: Int)
}
Constructors
-
Date(year: Int, month: Month, day: Int)
pub type DateTime {
DateTime(naive: NaiveDateTime, offset: Offset)
}
Constructors
-
DateTime(naive: NaiveDateTime, offset: Offset)
pub type Duration {
Duration(nanoseconds: Int)
}
Constructors
-
Duration(nanoseconds: Int)
pub type Error {
TimeInvalidFormat
TimeOutOfBounds
DateInvalidFormat
DateOutOfBounds
MonthInvalidFormat
MonthOutOfBounds
OffsetInvalidFormat
OffsetOutOfBounds
NaiveDateTimeInvalidFormat
NaiveDateTimeOutOfBounds
DateTimeInvalidFormat
DateTimeOutOfBounds
}
Constructors
-
TimeInvalidFormat
-
TimeOutOfBounds
-
DateInvalidFormat
-
DateOutOfBounds
-
MonthInvalidFormat
-
MonthOutOfBounds
-
OffsetInvalidFormat
-
OffsetOutOfBounds
-
NaiveDateTimeInvalidFormat
-
NaiveDateTimeOutOfBounds
-
DateTimeInvalidFormat
-
DateTimeOutOfBounds
pub type Month {
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
}
Constructors
-
Jan
-
Feb
-
Mar
-
Apr
-
May
-
Jun
-
Jul
-
Aug
-
Sep
-
Oct
-
Nov
-
Dec
pub type NaiveDateTime {
NaiveDateTime(date: Date, time: Time)
}
Constructors
-
NaiveDateTime(date: Date, time: Time)
pub type Period {
Period(start: NaiveDateTime, end: NaiveDateTime)
}
Constructors
-
Period(start: NaiveDateTime, end: NaiveDateTime)
Do not use the ==
operator to check for time equality! Use the compare
functions instead.
Second precision is defined as different variants to have a way to preserve precision when going to and from strings or other representations.
pub type Time {
Time(hour: Int, minute: Int, second: Int, nanosecond: Int)
TimeMilli(hour: Int, minute: Int, second: Int, nanosecond: Int)
TimeMicro(hour: Int, minute: Int, second: Int, nanosecond: Int)
TimeNano(hour: Int, minute: Int, second: Int, nanosecond: Int)
}
Constructors
-
Time(hour: Int, minute: Int, second: Int, nanosecond: Int)
-
TimeMilli(hour: Int, minute: Int, second: Int, nanosecond: Int)
-
TimeMicro(hour: Int, minute: Int, second: Int, nanosecond: Int)
-
TimeNano(hour: Int, minute: Int, second: Int, nanosecond: Int)
pub type UncertainConversion(a) {
Precise(a)
Imprecise(a)
}
Constructors
-
Precise(a)
-
Imprecise(a)
Constants
Functions
pub fn accept_imprecision(conv: UncertainConversion(a)) -> a
pub fn error_on_imprecision(
conv: UncertainConversion(a),
) -> Result(a, Nil)