onasty/web/src/Time/Format.elm(view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
module Time.Format exposing (toString)
import DateFormat
import Time exposing (Posix, Zone)
{-| Formats a given `Posix` time and `Zone` into a human-readable string.
toString zone posix
> "July 2nd, 2025 21:05"
-}
toString : Zone -> Posix -> String
toString =
DateFormat.format
[ DateFormat.monthNameFull
, DateFormat.text " "
, DateFormat.dayOfMonthSuffix
, DateFormat.text ", "
, DateFormat.yearNumber
, DateFormat.text " "
, DateFormat.hourMilitaryFromOneNumber
, DateFormat.text ":"
, DateFormat.minuteFixed
]
|