rluiten/elm-date-extra/4.0.1

NOTE: this package is not compatible with Elm 0.19.1

Date.Extra.Floor

Reduce a date to a given granularity this is similar in concept to floor on Float so was named the same.

This allows you to modify a date to reset to minimum values all values below a given granularity.

This operates in local time zone so if you are not in UTC time zone and you output date in UTC time zone the datefields will not be floored.

Example Floor.floor Hour date will return a modified date with

  • Minutes to 0
  • Seconds to 0
  • Milliseconds to 0
floor : Floor -> Date -> Date

Floor date by reducing to minimum value all values below given granularity.

This floors in local time zone values, as the date element parts are pulled straight from the local time zone date values.

type Floor
= Millisecond
| Second
| Minute
| Hour
| Day
| Month
| Year

Date granularity of operations.

This modules implementation became much simpler when Field module was introduced.

Copyright (c) 2016 Robin Luiten