Date Utils.
Create a date in current time zone from given fields. All field values are clamped to there allowed range values. Hours are input in 24 hour time range 0 to 23 valid. This return dates in current time zone.
Using algorithm from http://howardhinnant.github.io/date_algorithms.html Specifically days_from_civil function.
The two *Compensate values adjust for the zone offset time
introduced by Date.fromTime 0 for local timezone.
Create a time in current time zone from given fields, for when you dont care about the date part but need time part anyway.
All field values are clamped to there allowed range values. This can only return dates in current time zone.
Hours are input in 24 hour time range 0 to 23 valid.
This defaults to year 1970, month Jan, day of month 1 for date part.
Be careful with unsafeFromString it will Debug.crash() if it cant parse date.
Utility for known input string date creation cases. Checks for a fail just in case and calls Debug.crash().
Return a list of days dayLength long for successive days starting from startDate.
Return iso week values year, week, isoDayOfWeek.
Return date of start of week one for year.
Copyright (c) 2016 Robin Luiten
Elm Date.fromString suffers from the some of the same javascript unusual compensation of input ranges when converting strings to Dates.
This method makes some known undesirable no Err results return Err.
This example produces
Ok "2012-03-02"withou the checkDateResult.checkDateResult tries to catch and mark as Err some of these cases.