Utils for working with dates.
isLeapYear : Basics.Int -> Basics.Bool
If the year is a leap year, return True. False otherwise.
isLeapYear 2018 == False
isLeapYear 2016 == True
getNextMonth : Time.Month -> Time.Month
Given a month, return the next month.
getNextMonth Apr == May
getPrevMonth : Time.Month -> Time.Month
Given a month, return the previous month.
getPrevMonth Apr == May
monthToNumber : Time.Month -> Basics.Int
Convert the month to a number in the range [0, 11]
monthToNumber1 : Time.Month -> Basics.Int
Convert the month to a number in the range [1, 12]
numberToMonth : Basics.Int -> Maybe Time.Month
Given a number from 0 to 11, convert it to the corresponding month.
numberOfDaysInMonth : Basics.Int -> Time.Month -> Basics.Int
Return the number of days in a month.
numberOfDaysInMonth 2018 Feb == 28
numberOfDaysInMonth 2016 Feb == 29
getWeekday : Time.Zone -> Time.Posix -> Time.Weekday
Given a Time, return the Weekday
getNextWeekday : Time.Weekday -> Time.Weekday
Given a Weekday
, get the next weekday.
getNextWeekday Sun == Mon
getPrevWeekday : Time.Weekday -> Time.Weekday
Given a Weekday
, get the previous weekday.
getPrevWeekday Sun == Sat
weekdayToNumber : Time.Weekday -> Basics.Int
Convert the Weekday to a number representation. Starts with 0 on Monday.
weekdayToNumber Mon == 0
weekdayToNumber Sun == 6
weekdayFromNumber : Basics.Int -> Maybe Time.Weekday
Convert a number to a weekday. 0 is for Monday.
weekdayFromNumber 0 == Just Mon
weekdayFromNumber 6 == Just Sun
weekdayFromNumber 8 == Nothing
weekdayDiff : Time.Weekday -> Time.Weekday -> Basics.Int
Get the difference in days between two weekdays. Assume always forward direction. For example, the returned value from Friday to Wednesday is 5.
weekdayDiff Fri Wed == 5
weekdayDiff Mon Wed == 2
weekdayDiffBack : Time.Weekday -> Time.Weekday -> Basics.Int
Get the difference in days between two weekdays. It works in the backwards direction. For example, the returned value from Friday to Wednesday is 2.
weekdayDiffBack Fri Wed == 2
weekdayDiffBack Mon Wed == 5
resetTime : Time.Posix -> Time.Posix
Given a datetime, set the time to 00:00:00.000
getIsoFormat : String -> Time.Zone -> Time.Posix -> String
Get the iso format of the date