enkidatron / elm-cldr / Cldr.Format.Date

Date Formatting

format : FormatType -> Internal.Locale.Locale -> Date -> String

Formats a Date using the specified FormatType and Locale.

import Cldr.Format.Length exposing (Length(..))
import Cldr.Locale exposing (en)
import Date
import Time exposing (Month(..))

let
    date = Date.fromCalendarDate 2000 Jan 1
in
format (WithLength Short) en date
--> "1/1/00"

Format Type


type FormatType
    = WithLength Cldr.Format.Length.Length
    | WithOptions Cldr.Format.Options.DateOptions

Dates can be formatted using a Cldr.Format.Length.Length or Cldr.Format.Options.DateOptions.