adius/vectual/6.0.0

Renamed to ad-si/Vectual. That is where the repository lives now. It has not been published as a package under the new name.

Versions published as adius/vectual still install under that name. 3 versions of 7 come from the new location (see their notes).

TimeUtils.Field

Setting a date field on a date.

fieldToDate : Field -> Posix -> Maybe Posix

Set a field on a date to a specific value.

If your value in field is out side of valid range for the date field this function will return Nothing.

  • DayOfWeek cannot be invalid input range
  • Month cannot be invalid

Valid ranges

  • Millisecond 0 to 999
  • Second 0 to 59
  • Minute 0 to 59
  • Hour 0 to 23
  • DayOfMonth 1 to max day of month for year
  • Year >= 0
fieldToDateClamp : Field -> Posix -> Posix

Set a field on a date to a specific value.

This version clamps any input Field values to valid ranges as described in the doc for fieldToDate function.

type Field
= Millisecond Int
| Second Int
| Minute Int
| Hour Int
| DayOfWeek ( Weekday, Weekday )
| DayOfMonth Int
| Month Month
| Year Int

Configured Field and Value to set on date.

All field values are applied Modulus there maximum value.

  • DayOfWeek
    • The week keeps the same start of week day as passed in and changes day.
  • Month
    • Will not change year only the month of year.
fieldToString : Field -> String