elm-community / elm-time

A pure Elm date and time library.

Home Page:http://package.elm-lang.org/packages/elm-community/elm-time/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dayDiff or dayDelta

z5h opened this issue · comments

This is a request to implement a dayDiff or dayDelta function that would return the number of days between 2 dates.

How would this be different from Time.Date.delta?

I misunderstood the documentation. I expected each of years, months and days to be a component of the delta. Not that each was a separate delta. Therefore, I thought the delta between 2011-01-01 and 2012-01-01 would be { years = 1, months = 0, days = 0 }.

I think it would have been less confusing to have 3 methods: yearDelta, monthDelta, and dayDelta. In any case, the method you provide gives me what I need so I won't be fussy. Thank you for elm-time!!

I just re-read the documentation for diff and agree that it is confusing. I'll fix that before the next release. Thanks!