This module defines the Formatter types. It is based on the Java's DateTimeFormatter format.
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) : FormatPart
A string literal.
- modifier (modifier : Modifier) : FormatPart
A modifier that renders some data into text.
Instances For
Equations
- Std.Time.instReprFormatPart = { reprPrec := Std.Time.instReprFormatPart.repr }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
The format of date and time string.
Equations
Instances For
Equations
Configuration options for formatting and parsing date/time strings.
- allowLeapSeconds : Bool
Whether to allow leap seconds, such as
2016-12-31T23:59:60Z. Default isfalse. - dateformat : DateFormat
Locale configuration for formatting and parsing, including locale-specific symbols and the first day of the week used for week-of-year and week-of-month calculations. Default is
DateFormat.enUS(English, US).
Instances For
Equations
A specification on how to format a data or parse some string.
- config : FormatConfig
Configuration options for formatting behavior.
- string : FormatString
The format string used for parsing and formatting.
Instances For
Equations
Classify a PlainTime into a DayPeriod for the b pattern.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Classify a PlainTime into an ExtendedDayPeriod for the B pattern (CLDR flexible periods).
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.Y 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.M presentation) = Std.Time.Month.Ordinal
- Std.Time.TypeFormat (Std.Time.Modifier.L presentation) = Std.Time.Month.Ordinal
- Std.Time.TypeFormat (Std.Time.Modifier.d presentation) = Std.Time.Day.Ordinal
- Std.Time.TypeFormat (Std.Time.Modifier.Q presentation) = Std.Time.Month.Quarter
- Std.Time.TypeFormat (Std.Time.Modifier.q presentation) = Std.Time.Month.Quarter
- Std.Time.TypeFormat (Std.Time.Modifier.w presentation) = Std.Time.Week.OfYear.Ordinal
- Std.Time.TypeFormat (Std.Time.Modifier.W presentation) = Std.Time.Week.Ordinal
- Std.Time.TypeFormat (Std.Time.Modifier.E presentation) = Std.Time.Weekday
- Std.Time.TypeFormat (Std.Time.Modifier.e presentation) = Std.Time.Weekday
- Std.Time.TypeFormat (Std.Time.Modifier.c presentation) = Std.Time.Weekday
- Std.Time.TypeFormat (Std.Time.Modifier.F presentation) = Std.Time.Week.Aligned.Ordinal
- Std.Time.TypeFormat (Std.Time.Modifier.a presentation) = Std.Time.HourMarker
- Std.Time.TypeFormat (Std.Time.Modifier.b presentation) = Std.Time.DayPeriod
- Std.Time.TypeFormat (Std.Time.Modifier.B presentation) = Std.Time.ExtendedDayPeriod
- 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 presentation) = String
- Std.Time.TypeFormat (Std.Time.Modifier.z presentation) = String
- Std.Time.TypeFormat (Std.Time.Modifier.v 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 month name using the given locale symbols and returns the corresponding Month.Ordinal.
Equations
- Std.Time.parseMonthShort symbols = Std.Time.monthOfIndex✝ <$> Std.Time.parseName✝ symbols.monthShort
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
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 DateTime.
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 DateTime 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!" 975 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 = have dateformat := format.config.dateformat; Std.Time.GenericFormat.formatGeneric.go✝ getInfo dateformat "" format.string
Instances For
Formats the given parts of a date and time: a date, a time of day and a zone. Returns none when the
format needs a part that is missing, such as an hour for a date alone.
Equations
- format.formatParts date time zone = format.formatGeneric (Std.Time.fieldValue?✝ format.config.dateformat date time zone)
Instances For
Formats a DateTime value into a string using the given GenericFormat.
Equations
Instances For
Constructs a FormatType function to format a date into a string using a GenericFormat.
Equations
- format.formatBuilder = have dateformat := format.config.dateformat; Std.Time.GenericFormat.formatBuilder.go✝ dateformat "" format.string