std.time.duration
adjust-days
added in 3.0
(adjust-days {:keys [years months], :or {years 0, months 0}} {:keys [year month day], :as rep})calculates the number of days to be forwarded based on year and month (adjust-days {:years 0 :months 2} {:year 2012 :month 1 :day 31}) => 60
(adjust-days {:years 1 :months 2} {:year 2012 :month 1 :day 31}) => 425
(adjust-days {:months 2} {:year 2012 :month 1 :day 31 :backward true}) => 62
(adjust-days {:years 1} {:year 2013 :month 1 :day 31 :backward true}) => 366
adjust-month-days
added in 3.0
(adjust-month-days years months {:keys [year month day backward]})calculates the number of days to be adjusted based on month (adjust-month-days 0 2 {:year 2012 :month 3 :day 1}) => 61
(adjust-month-days 0 2 {:year 2012 :month 3 :day 1 :backward true}) => 60
(adjust-month-days 1 2 {:year 2011 :month 1 :day 3}) => 60
(adjust-month-days 1 2 {:year 2012 :month 1 :day 3}) => 59
adjust-year-days
added in 3.0
(adjust-year-days years {:keys [year month day backward]})calculates the number of days to be adjusted based on year (adjust-year-days 1 {:year 2012 :month 2 :day 28}) => 366
(adjust-year-days 1 {:year 2012 :month 2 :day 29}) => 365
(adjust-year-days 1 {:year 2012 :month 3 :day 1}) => 365
(adjust-year-days 1 {:year 2011 :month 3 :day 1}) => 366
map-to-length
added in 3.0
(map-to-length d rep)converts a duration to a length (map-to-length {:months 2} {:year 2012 :month 1 :day 31 :backward true}) => 5356800000
to-fixed-length
added in 3.0
(to-fixed-length m)converts a duration map to a duration in milliseconds (to-fixed-length {:days 1 :hours 3}) => 97200000
(to-fixed-length {:weeks 2 :days 7 :hours 53}) => 2005200000