This file defines Cedar datetime values and functions.
A datetime value is measured in milliseconds and constructed from a datetime string. A datetime string must be of one of the forms:
YYYY-MM-DD(date only)YYYY-MM-DDThh:mm:ssZ(UTC)YYYY-MM-DDThh:mm:ss.SSSZ(UTC with millisecond precision)YYYY-MM-DDThh:mm:ss(+|-)hhmm(With timezone offset in hours and minutes)YYYY-MM-DDThh:mm:ss.SSS(+|-)hhmm(With timezone offset in hours and minutes and millisecond precision)
Regardless of the timezone, offset is always normalized to UTC.
The datetime type does not provide a way to create a datetime from a Unix timestamp. One of the readable formats listed above must be used instead.
- val : Int64
Instances For
Equations
- Cedar.Spec.Ext.instLTDatetime = { lt := fun (d₁ d₂ : Cedar.Spec.Ext.Datetime) => d₁.lt d₂ = true }
Equations
- Cedar.Spec.Ext.instLEDatetime = { le := fun (d₁ d₂ : Cedar.Spec.Ext.Datetime) => d₁.le d₂ = true }
Equations
- Cedar.Spec.Ext.instReprDatetime.repr x✝ prec✝ = Std.Format.bracket "{ " (Std.Format.nil ++ Std.Format.text "val" ++ Std.Format.text " := " ++ (Std.Format.nest 7 (repr x✝.val)).group) " }"
Instances For
Equations
Equations
Instances For
Equations
Equations
- Cedar.Spec.Ext.Datetime.datetime? i = do let a ← Int64.ofInt? i pure { val := a }
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
A duration value is measured in milliseconds and constructed from a duration string. A duration string is a concatenated sequence of quantity-unit pairs where the quantity is a natural number and unit is one of the following:
d(for days)h(for hours)m(for minutes)s(for seconds)ms(for milliseconds)
Duration strings are required to be ordered from largest unit to smallest unit, and contain one quantity per unit. Units with zero quantity may be omitted.
A duration may be negative. Negative duration strings must begin with -.
- val : Int64
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
Instances For
Equations
- Cedar.Spec.Ext.Datetime.instLTDuration = { lt := fun (d₁ d₂ : Cedar.Spec.Ext.Datetime.Duration) => d₁.lt d₂ = true }
Equations
- Cedar.Spec.Ext.Datetime.instLEDuration = { le := fun (d₁ d₂ : Cedar.Spec.Ext.Datetime.Duration) => d₁.le d₂ = true }
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Create a Duration from an Int representing its internal encoding. Most callers should use higher-level constructors, e.g., Duration.parse
Equations
- Cedar.Spec.Ext.Datetime.duration? i = do let a ← Int64.ofInt? i pure { val := a }
Instances For
Equations
- Cedar.Spec.Ext.Datetime.Duration.parse str = match Cedar.Spec.Ext.Datetime.isNegativeDuration✝ str with | (isNegative, restStr) => Cedar.Spec.Ext.Datetime.parseDuration?✝ isNegative restStr
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- duration.toMilliseconds = duration.val
Instances For
Equations
- duration.toSeconds = duration.toMilliseconds / 1000