n1k0 / elm-daterange-picker / DateRangePicker.Range

Date range management.

Range


type Range

A time range between two Time.Posix.

create : Time.Zone -> Time.Posix -> Time.Posix -> Range

Creates a Range from two Posix timestamps.

Note: Posix args order is not important as it's internally managed.

beginsAt : Range -> Time.Posix

Retrieves the Posix the Range begins at.

endsAt : Range -> Time.Posix

Retrieves the Posix the Range ends at.

Helpers

between : Time.Posix -> Range -> Basics.Bool

Checks if a Time.Posix is comprised within a Range.

days : Range -> Basics.Int

Computes the number of days in a Range, floored.

format : Time.Zone -> Range -> String

Formats a Range in simple fashion.

Conversion

decode : Json.Decode.Decoder Range

Decodes a Range from JSON.

encode : Range -> Json.Encode.Value

Encodes a Range to JSON.

fromString : String -> Maybe Range

Extract a Range from a String, where the two Posix timestamps are encoded as UTC to Iso8601 format and joined with a ; character.

toString : Range -> String

Turns a Range into a String, where the two Posix timestamps are encoded as UTC to Iso8601 format and joined with a ; character.

toTuple : Range -> ( Time.Posix, Time.Posix )

Converts a Range into a Tuple.