enkidatron/elm-cldr/2.3.0

NOTE: the latest version is 3.2.1

Cldr.Format.OptionsBuilder

Build options records using type-safe helper functions.

import Cldr.Format.Options exposing (..)


options : DateTimeOptions
options =
    initDateTime
        |> setYear Numeric
        |> setMonthText Short
        |> setDay Numeric
        |> setHour Numeric
        |> setMinute TwoDigit
        |> setPeriod Short
        |> toOptions

An opaque type that uses the "phantom builder" pattern.

Initialize

initDateTime : OptionsBuilder EmptyDateTime DateTimeOptions

Start building a DateTimeOptions value

initDate : OptionsBuilder EmptyDate DateOptions

Start building a DateTime value

Set options

Date options

-> OptionsBuilder (EraNotSetYet a) (HasEra b)
-> OptionsBuilder a (HasEra b)

Set the era field.

-> OptionsBuilder (YearNotSetYet a) (HasYear b)
-> OptionsBuilder a (HasYear b)

Set the year field.

-> OptionsBuilder (MonthNotSetYet a) (HasMonth b)
-> OptionsBuilder a (HasMonth b)

Set the month field to a NumberOption value.

-> OptionsBuilder (MonthNotSetYet a) (HasMonth b)
-> OptionsBuilder a (HasMonth b)

Set the month field to a TextOption value.

-> OptionsBuilder (DayNotSetYet a) (HasDay b)
-> OptionsBuilder a (HasDay b)

Set the day field.

-> OptionsBuilder (WeekdayNotSetYet a) (HasWeekday b)
-> OptionsBuilder a (HasWeekday b)

Set the weekday field.

DateTime specific options

-> OptionsBuilder (PeriodNotSetYet a) (HasPeriod b)
-> OptionsBuilder a (HasPeriod b)

Set the period field.

-> OptionsBuilder (HourNotSetYet a) (HasHour b)
-> OptionsBuilder a (HasHour b)

Set the hour field.

-> OptionsBuilder (MinuteNotSetYet a) (HasMinute b)
-> OptionsBuilder a (HasMinute b)

Set the minute field.

-> OptionsBuilder (SecondNotSetYet a) (HasSecond b)
-> OptionsBuilder a (HasSecond b)

Set the second field.

(FractionalSecondDigitsNotSetYet a)
(HasFractionalSecondDigits b)
-> OptionsBuilder a (HasFractionalSecondDigits b)

Set the fractionalSecondDigits field.

-> OptionsBuilder (ZoneNotSetYet a) (HasZone b)
-> OptionsBuilder a (HasZone b)

Set the zone field.

-> OptionsBuilder (Hour12NotSetYet a) (HasHour12 b)
-> OptionsBuilder a (HasHour12 b)

Set the hour12 field.

Convert

Get the options that you have built.