This module defines the Formatter types. It is based on the Java's DateTimeFormatter format.
Equations
- Std.Time.instReprText = { reprPrec := Std.Time.instReprText.repr }
Equations
- Std.Time.instReprText.repr Std.Time.Text.short prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Std.Time.Text.short")).group prec✝
- Std.Time.instReprText.repr Std.Time.Text.full prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Std.Time.Text.full")).group prec✝
- Std.Time.instReprText.repr Std.Time.Text.narrow prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Std.Time.Text.narrow")).group prec✝
Instances For
Equations
Instances For
Equations
- Std.Time.instReprNumber = { reprPrec := Std.Time.instReprNumber.repr }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
- Std.Time.instInhabitedNumber.default = { padding := default }
Instances For
classifyNumberText classifies the number of pattern letters into either a Number or Text.
Equations
Instances For
Equations
- Std.Time.instReprFraction = { reprPrec := Std.Time.instReprFraction.repr }
Equations
- One or more equations did not get rendered due to their size.
- Std.Time.instReprFraction.repr Std.Time.Fraction.nano prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Std.Time.Fraction.nano")).group prec✝
Instances For
Instances For
Equations
Year represents different year formatting styles based on the number of pattern letters.
- any : YearAny size (e.g., "19000000000000") 
- twoDigit : YearTwo-digit year format (e.g., "23" for 2023) 
- fourDigit : YearFour-digit year format (e.g., "2023") 
- extended
(num : Nat)
 : YearExtended year format for more than 4 digits (e.g., "002023") 
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Std.Time.instReprYear.repr Std.Time.Year.any prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Std.Time.Year.any")).group prec✝
- Std.Time.instReprYear.repr Std.Time.Year.twoDigit prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Std.Time.Year.twoDigit")).group prec✝
- Std.Time.instReprYear.repr Std.Time.Year.fourDigit prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Std.Time.Year.fourDigit")).group prec✝
Instances For
Equations
- Std.Time.instReprYear = { reprPrec := Std.Time.instReprYear.repr }
Instances For
Equations
Equations
- Std.Time.instReprZoneId.repr Std.Time.ZoneId.short prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Std.Time.ZoneId.short")).group prec✝
- Std.Time.instReprZoneId.repr Std.Time.ZoneId.full prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Std.Time.ZoneId.full")).group prec✝
Instances For
Equations
- Std.Time.instReprZoneId = { reprPrec := Std.Time.instReprZoneId.repr }
Equations
Instances For
classify classifies the number of pattern letters into a ZoneId format.
- If 2 letters, it returns the short form.
- If 4 letters, it returns the full form.
- Otherwise, it returns none.
Equations
- Std.Time.ZoneId.classify num = if num = 2 then some Std.Time.ZoneId.short else if num = 4 then some Std.Time.ZoneId.full else none
Instances For
Equations
- Std.Time.instReprZoneName.repr Std.Time.ZoneName.short prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Std.Time.ZoneName.short")).group prec✝
- Std.Time.instReprZoneName.repr Std.Time.ZoneName.full prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Std.Time.ZoneName.full")).group prec✝
Instances For
Equations
- Std.Time.instReprZoneName = { reprPrec := Std.Time.instReprZoneName.repr }
Equations
Instances For
classify classifies the number of pattern letters and the letter type ('z' or 'v')
into a ZoneName format.
- For 'z', if less than 4 letters, it returns the short form; if 4 letters, it returns the full form.
- For 'v', if 1 letter, it returns the short form; if 4 letters, it returns the full form.
- Otherwise, it returns none.
Equations
- One or more equations did not get rendered due to their size.
Instances For
OffsetX represents different offset formats based on the number of pattern letters.
The output will vary between the number of pattern letters, whether it's the hour, minute, second,
and whether colons are used.
- hour : OffsetXOnly the hour is output (e.g., "+01") 
- hourMinute : OffsetXHour and minute without colon (e.g., "+0130") 
- hourMinuteColon : OffsetXHour and minute with colon (e.g., "+01:30") 
- hourMinuteSecond : OffsetXHour, minute, and second without colon (e.g., "+013015") 
- hourMinuteSecondColon : OffsetXHour, minute, and second with colon (e.g., "+01:30:15") 
Instances For
Equations
- Std.Time.instReprOffsetX = { reprPrec := Std.Time.instReprOffsetX.repr }
Equations
- One or more equations did not get rendered due to their size.
- Std.Time.instReprOffsetX.repr Std.Time.OffsetX.hour prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Std.Time.OffsetX.hour")).group prec✝
- Std.Time.instReprOffsetX.repr Std.Time.OffsetX.hourMinute prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Std.Time.OffsetX.hourMinute")).group prec✝
Instances For
Instances For
Equations
Equations
- Std.Time.instReprOffsetO = { reprPrec := Std.Time.instReprOffsetO.repr }
Equations
- Std.Time.instReprOffsetO.repr Std.Time.OffsetO.short prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Std.Time.OffsetO.short")).group prec✝
- Std.Time.instReprOffsetO.repr Std.Time.OffsetO.full prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Std.Time.OffsetO.full")).group prec✝
Instances For
Equations
Instances For
OffsetZ represents different offset formats based on the number of pattern letters (capital 'Z').
- hourMinute : OffsetZHour and minute without colon (e.g., "+0130") 
- full : OffsetZLocalized offset text in full form (e.g., "GMT+08:00") 
- hourMinuteSecondColon : OffsetZHour, minute, and second with colon (e.g., "+01:30:15") 
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Std.Time.instReprOffsetZ.repr Std.Time.OffsetZ.hourMinute prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Std.Time.OffsetZ.hourMinute")).group prec✝
- Std.Time.instReprOffsetZ.repr Std.Time.OffsetZ.full prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Std.Time.OffsetZ.full")).group prec✝
Instances For
Equations
- Std.Time.instReprOffsetZ = { reprPrec := Std.Time.instReprOffsetZ.repr }
Instances For
Equations
classify classifies the number of pattern letters into an OffsetZ format.
Equations
- Std.Time.OffsetZ.classify 1 = some Std.Time.OffsetZ.hourMinute
- Std.Time.OffsetZ.classify 2 = some Std.Time.OffsetZ.hourMinute
- Std.Time.OffsetZ.classify 3 = some Std.Time.OffsetZ.hourMinute
- Std.Time.OffsetZ.classify 4 = some Std.Time.OffsetZ.full
- Std.Time.OffsetZ.classify 5 = some Std.Time.OffsetZ.hourMinuteSecondColon
- Std.Time.OffsetZ.classify num = none
Instances For
The Modifier inductive type represents various formatting options for date and time components,
matching the format symbols used in date and time strings.
These modifiers can be applied in formatting functions to generate custom date and time outputs.
- G
(presentation : Text)
 : ModifierG: Era (e.g., AD, Anno Domini, A).
- y
(presentation : Year)
 : Modifiery: Year of era (e.g., 2004, 04, 0002, 2).
- u
(presentation : Year)
 : Modifieru: Year (e.g., 2004, 04, -0001, -1).
- D
(presentation : Number)
 : ModifierD: Day of year (e.g., 189).
- MorL
(presentation : Number ⊕ Text)
 : ModifierM: Month of year as number or text (e.g., 7, 07, Jul, July, J).
- d
(presentation : Number)
 : Modifierd: Day of month (e.g., 10).
- Qorq
(presentation : Number ⊕ Text)
 : ModifierQ: Quarter of year as number or text (e.g., 3, 03, Q3, 3rd quarter).
- w
(presentation : Number)
 : Modifierw: Week of week-based year (e.g., 27).
- W
(presentation : Number)
 : ModifierW: Week of month (e.g., 4).
- E
(presentation : Text)
 : ModifierE: Day of week as text (e.g., Tue, Tuesday, T).
- eorc
(presentation : Number ⊕ Text)
 : Modifiere: Localized day of week as number or text (e.g., 2, 02, Tue, Tuesday, T).
- F
(presentation : Number)
 : ModifierF: Aligned week of month (e.g., 3).
- a
(presentation : Text)
 : Modifiera: AM/PM of day (e.g., PM).
- h
(presentation : Number)
 : Modifierh: Clock hour of AM/PM (1-12) (e.g., 12).
- K
(presentation : Number)
 : ModifierK: Hour of AM/PM (0-11) (e.g., 0).
- k
(presentation : Number)
 : Modifierk: Clock hour of day (1-24) (e.g., 24).
- H
(presentation : Number)
 : ModifierH: Hour of day (0-23) (e.g., 0).
- m
(presentation : Number)
 : Modifierm: Minute of hour (e.g., 30).
- s
(presentation : Number)
 : Modifiers: Second of minute (e.g., 55).
- S
(presentation : Fraction)
 : ModifierS: Fraction of second (e.g., 978).
- A
(presentation : Number)
 : ModifierA: Millisecond of day (e.g., 1234).
- n
(presentation : Number)
 : Modifiern: Nanosecond of second (e.g., 987654321).
- N
(presentation : Number)
 : ModifierN: Nanosecond of day (e.g., 1234000000).
- V : ModifierV: Time zone ID (e.g., America/Los_Angeles, Z, -08:30).
- z
(presentation : ZoneName)
 : Modifierz: Time zone name (e.g., Pacific Standard Time, PST).
- O
(presentation : OffsetO)
 : ModifierO: Localized zone offset (e.g., GMT+8, GMT+08:00, UTC-08:00).
- X
(presentation : OffsetX)
 : ModifierX: Zone offset with 'Z' for zero (e.g., Z, -08, -0830, -08:30).
- x
(presentation : OffsetX)
 : Modifierx: Zone offset without 'Z' (e.g., +0000, -08, -0830, -08:30).
- Z
(presentation : OffsetZ)
 : ModifierZ: Zone offset with 'Z' for UTC (e.g., +0000, -0800, -08:00).
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Std.Time.instReprModifier.repr Std.Time.Modifier.V prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Std.Time.Modifier.V")).group prec✝
Instances For
Equations
- Std.Time.instReprModifier = { reprPrec := Std.Time.instReprModifier.repr }
Equations
Instances For
The part of a formatting string. A string is just a text and a modifier is in the format described in
the Modifier type.
- string
(val : String)
 : FormatPartA string literal. 
- modifier
(modifier : Modifier)
 : FormatPartA modifier that renders some data into text. 
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Std.Time.instReprFormatPart = { reprPrec := Std.Time.instReprFormatPart.repr }
Equations
Equations
The format of date and time string.
Equations
Instances For
Equations
Equations
Instances For
Configuration options for formatting and parsing date/time strings.
- allowLeapSeconds : BoolWhether to allow leap seconds, such as 2016-12-31T23:59:60Z. Default isfalse.
Instances For
Equations
Equations
- Std.Time.instInhabitedFormatConfig.default = { allowLeapSeconds := default }
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
A specification on how to format a data or parse some string.
- config : FormatConfigConfiguration options for formatting behavior. 
- string : FormatStringThe format string used for parsing and formatting. 
Instances For
Equations
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Std.Time.TypeFormat (Std.Time.Modifier.G presentation) = Std.Time.Year.Era
- Std.Time.TypeFormat (Std.Time.Modifier.y presentation) = Std.Time.Year.Offset
- Std.Time.TypeFormat (Std.Time.Modifier.u presentation) = Std.Time.Year.Offset
- Std.Time.TypeFormat (Std.Time.Modifier.D presentation) = Sigma Std.Time.Day.Ordinal.OfYear
- Std.Time.TypeFormat (Std.Time.Modifier.MorL presentation) = Std.Time.Month.Ordinal
- Std.Time.TypeFormat (Std.Time.Modifier.d presentation) = Std.Time.Day.Ordinal
- Std.Time.TypeFormat (Std.Time.Modifier.Qorq presentation) = Std.Time.Month.Quarter
- Std.Time.TypeFormat (Std.Time.Modifier.w presentation) = Std.Time.Week.Ordinal
- Std.Time.TypeFormat (Std.Time.Modifier.W presentation) = Std.Time.Week.Ordinal.OfMonth
- Std.Time.TypeFormat (Std.Time.Modifier.E presentation) = Std.Time.Weekday
- Std.Time.TypeFormat (Std.Time.Modifier.eorc presentation) = Std.Time.Weekday
- Std.Time.TypeFormat (Std.Time.Modifier.F presentation) = Std.Time.Internal.Bounded.LE 1 5
- Std.Time.TypeFormat (Std.Time.Modifier.a presentation) = Std.Time.HourMarker
- Std.Time.TypeFormat (Std.Time.Modifier.h presentation) = Std.Time.Internal.Bounded.LE 1 12
- Std.Time.TypeFormat (Std.Time.Modifier.K presentation) = Std.Time.Internal.Bounded.LE 0 11
- Std.Time.TypeFormat (Std.Time.Modifier.k presentation) = Std.Time.Internal.Bounded.LE 1 24
- Std.Time.TypeFormat (Std.Time.Modifier.H presentation) = Std.Time.Hour.Ordinal
- Std.Time.TypeFormat (Std.Time.Modifier.m presentation) = Std.Time.Minute.Ordinal
- Std.Time.TypeFormat (Std.Time.Modifier.s presentation) = Std.Time.Second.Ordinal true
- Std.Time.TypeFormat (Std.Time.Modifier.S presentation) = Std.Time.Nanosecond.Ordinal
- Std.Time.TypeFormat (Std.Time.Modifier.A presentation) = Std.Time.Millisecond.Offset
- Std.Time.TypeFormat (Std.Time.Modifier.n presentation) = Std.Time.Nanosecond.Ordinal
- Std.Time.TypeFormat (Std.Time.Modifier.N presentation) = Std.Time.Nanosecond.Offset
- Std.Time.TypeFormat Std.Time.Modifier.V = String
- Std.Time.TypeFormat (Std.Time.Modifier.z presentation) = String
- Std.Time.TypeFormat (Std.Time.Modifier.O presentation) = Std.Time.TimeZone.Offset
- Std.Time.TypeFormat (Std.Time.Modifier.X presentation) = Std.Time.TimeZone.Offset
- Std.Time.TypeFormat (Std.Time.Modifier.x presentation) = Std.Time.TimeZone.Offset
- Std.Time.TypeFormat (Std.Time.Modifier.Z presentation) = Std.Time.TimeZone.Offset
Instances For
Parses a short value of a Month.Ordinal
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Std.Time.FormatType result (Std.Time.FormatPart.modifier entry :: xs) = (Std.Time.TypeFormat entry → Std.Time.FormatType result xs)
- Std.Time.FormatType result (Std.Time.FormatPart.string val :: xs) = Std.Time.FormatType result xs
- Std.Time.FormatType result [] = result
Instances For
Constructs a new GenericFormat specification for a date-time string. Modifiers can be combined to create
custom formats, such as "YYYY, MMMM, D".
Equations
- Std.Time.GenericFormat.spec input config = do let string ← Std.Time.specParser✝.run input pure { config := config, string := string }
Instances For
Builds a GenericFormat from the input string. If parsing fails, it will panic
Equations
- One or more equations did not get rendered due to their size.
Instances For
Formats a DateTime value into a string using the given GenericFormat.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parser for a format with a builder.
Equations
- Std.Time.GenericFormat.builderParser format config func = Std.Time.GenericFormat.builderParser.go✝ config format func
Instances For
Parses the input string into a ZoneDateTime.
Equations
- format.parse input = (Std.Time.GenericFormat.parser✝ format.string format.config aw <* Std.Internal.Parsec.eof).run input
Instances For
Parses the input string into a ZoneDateTime and panics if its wrong.
Equations
- format.parse! input = match format.parse input with | Except.ok res => res | Except.error err => panicWithPosWithDecl "Std.Time.Format.Basic" "Std.Time.GenericFormat.parse!" 1480 18 err
Instances For
Parses an input string using a builder function to produce a value.
Equations
- format.parseBuilder builder input = (Std.Time.GenericFormat.builderParser format.string format.config builder).run input
Instances For
Parses an input string using a builder function, panicking on errors.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Formats the date using the format into a String, using a getInfo function to get the information needed to build the String.
Equations
- format.formatGeneric getInfo = Std.Time.GenericFormat.formatGeneric.go✝ getInfo "" format.string
Instances For
Constructs a FormatType function to format a date into a string using a GenericFormat.
Equations
- format.formatBuilder = Std.Time.GenericFormat.formatBuilder.go✝ "" format.string
Instances For
Typeclass for formatting and parsing values with the given format type.
- format (fmt : f) : typ String fmtConverts a format finto a string.
- Parses a string into a format using the provided format type - f.
Instances
Equations
- Std.Time.instFormatGenericFormatFormatTypeString = { format := Std.Time.GenericFormat.formatBuilder, parse := fun {α : Type} => Std.Time.GenericFormat.parseBuilder }