arowM / tepa-zoned-time

TEPA library to handle zoned time.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tepa-zoned-time

test Elm package

TEPA library to handle zoned time.

A Quick Example

Construct ZonedTime

import Tepa.Time as Time

-- 1970-01-04T13:54:12.123Z
original : ZonedTime
original = fromPosix Time.utc (Time.millisToPosix 309252123)

midnight : ZonedTime
midnight = setToMidnight original
sample : Maybe ZonedTime
sample =
    fromGregorianUtc
        { year = 2000
        , month = Time.Jun
        , day = 10
        }
        |> Maybe.map (addHours 22)
        |> Maybe.map (addMinutes 33)
        |> Maybe.map (addSeconds 44)
        |> Maybe.map (addMillis 55)

Unwrap ZonedTime

import Tepa.Time as Time

posix : Maybe Time.Posix
posix =
    sample
        |> Maybe.map toPosix

zone : Maybe Time.Zone
zone =
    sample
        |> Maybe.map toZone

About

TEPA library to handle zoned time.

License:MIT License


Languages

Language:Elm 100.0%