adius / vectual / TimeUtils.Field

Setting a date field on a date.

fieldToDate : Field -> Time.Posix -> Maybe Time.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.

Valid ranges

fieldToDateClamp : Field -> Time.Posix -> Time.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 Basics.Int
    | Second Basics.Int
    | Minute Basics.Int
    | Hour Basics.Int
    | DayOfWeek (( Time.Weekday, Time.Weekday ))
    | DayOfMonth Basics.Int
    | Month Time.Month
    | Year Basics.Int

Configured Field and Value to set on date.

All field values are applied Modulus there maximum value.

fieldToString : Field -> String