Documentation

Std.Time.Format.Basic

This module defines the Formatter types. It is based on the Java's DateTimeFormatter format.

inductive Std.Time.Text :

Text represents different text formatting styles.

Instances For

    classify classifies the number of pattern letters into a Text type.

    Equations
    Instances For

      Number represents different number formatting styles.

      • padding : Nat

        The number of digits to pad, based on the count of pattern letters.

      Instances For
        Equations

        classifyNumberText classifies the number of pattern letters into either a Number or Text.

        Equations
        Instances For

          Fraction represents the fraction of a second, which can either be full nanoseconds or a truncated form with fewer digits.

          Instances For

            classify classifies the number of pattern letters into either a Fraction. It's used for nano.

            Equations
            Instances For
              inductive Std.Time.Year :

              Year represents different year formatting styles based on the number of pattern letters.

              • twoDigit : Std.Time.Year

                Two-digit year format (e.g., "23" for 2023)

              • fourDigit : Std.Time.Year

                Four-digit year format (e.g., "2023")

              • extended (num : Nat) : Std.Time.Year

                Extended year format for more than 4 digits (e.g., "002023")

              Instances For

                classify classifies the number of pattern letters into a Year format.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  ZoneId represents different time zone ID formats based on the number of pattern letters.

                  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
                    Instances For

                      ZoneName represents different zone name formats based on the number of pattern letters and whether daylight saving time is considered.

                      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.

                          Instances For

                            classify classifies the number of pattern letters into an OffsetX format.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For

                              OffsetO represents localized offset text formats based on the number of pattern letters.

                              Instances For

                                OffsetZ represents different offset formats based on the number of pattern letters (capital 'Z').

                                • hourMinute : Std.Time.OffsetZ

                                  Hour and minute without colon (e.g., "+0130")

                                • full : Std.Time.OffsetZ

                                  Localized offset text in full form (e.g., "GMT+08:00")

                                • hourMinuteSecondColon : Std.Time.OffsetZ

                                  Hour, minute, and second with colon (e.g., "+01:30:15")

                                Instances For

                                  classify classifies the number of pattern letters into an OffsetZ format.

                                  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.

                                    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.

                                      Instances For
                                        @[reducible, inline]

                                        The format of date and time string.

                                        Equations
                                        Instances For

                                          If the format is aware of some timezone data it parses or if it parses any timezone.

                                          Instances For
                                            Equations
                                            • One or more equations did not get rendered due to their size.

                                            A specification on how to format a data or parse some string.

                                            Instances For
                                              Equations
                                              • Std.Time.instInhabitedGenericFormat = { default := { string := default } }
                                              Equations
                                              • Std.Time.instReprGenericFormat = { reprPrec := Std.Time.reprGenericFormat✝ }

                                              Parses a short value of a Month.Ordinal

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              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
                                                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

                                                      Parses the input string into a ZoneDateTime.

                                                      Equations
                                                      Instances For

                                                        Parses the input string into a ZoneDateTime and panics if its wrong.

                                                        Equations
                                                        Instances For
                                                          def Std.Time.GenericFormat.parseBuilder {aw : Std.Time.Awareness} {α : Type} (format : Std.Time.GenericFormat aw) (builder : Std.Time.FormatType✝ (Option α) format.string) (input : String) :

                                                          Parses an input string using a builder function to produce a value.

                                                          Equations
                                                          Instances For
                                                            def Std.Time.GenericFormat.parseBuilder! {α : Type} {aw : Std.Time.Awareness} [Inhabited α] (format : Std.Time.GenericFormat aw) (builder : Std.Time.FormatType✝ (Option α) format.string) (input : String) :
                                                            α

                                                            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
                                                              Instances For
                                                                Equations
                                                                Instances For

                                                                  Constructs a FormatType function to format a date into a string using a GenericFormat.

                                                                  Equations
                                                                  Instances For
                                                                    Equations
                                                                    Instances For
                                                                      class Std.Time.Format (f : Type) (typ : TypefType) :

                                                                      Typeclass for formatting and parsing values with the given format type.

                                                                      • format (fmt : f) : typ String fmt

                                                                        Converts a format f into a string.

                                                                      • parse {α : Type} (fmt : f) : typ (Option α) fmtStringExcept 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 }