rluiten / elm-date-extra

Elm Date Extra library add/subtract/diff/format etc dates
http://package.elm-lang.org/packages/rluiten/elm-date-extra/latest
BSD 3-Clause "New" or "Revised" License
75 stars 36 forks source link

Date.Extra.Compare takes time into account #56

Closed bardt closed 6 years ago

bardt commented 7 years ago

An example here: https://ellie-app.com/qbFnhQG4ba1/0

I mistakenly expected Date.Extra.Compare to compare just dates, regardless the time and time zone. As shown in the example above, if we have dates from different sources (like parsing a string and constructing a date by hand), this function will not work as expected.

The supposed user workaround is reconstructing a date from fields before comparison, but I believe this logic should be somehow included in comparison functions themselves.

rluiten commented 7 years ago

Sorry for my tardiness, I just tried to follow your ellie link and don't seem to get anything using elm-date-extra.

Without seeing the code example I think you might want to use startOfTime http://package.elm-lang.org/packages/rluiten/elm-date-extra/latest/Date-Extra-TimeUnit#startOfTime

It will allow you clear any parts of your date you don't wish to have affect your comparison.