Skip to content

Commit

Permalink
Update DateTime.isSameDay
Browse files Browse the repository at this point in the history
  • Loading branch information
hojberg committed Aug 16, 2023
1 parent 5c68231 commit b61703c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion elm.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
"elm-community/list-extra": "8.2.0 <= v < 9.0.0",
"elm-community/maybe-extra": "5.2.0 <= v < 6.0.0",
"elm-community/string-extra": "4.0.0 <= v < 5.0.0",
"justinmimbs/time-extra": "1.1.1 <= v < 2.0.0",
"krisajenkins/remotedata": "6.0.0 <= v < 7.0.0",
"mgold/elm-nonempty-list": "4.1.0 <= v < 5.0.0",
"noahzgordon/elm-color-extra": "1.0.0 <= v < 2.0.0",
Expand Down
9 changes: 4 additions & 5 deletions src/UI/DateTime.elm
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ import Html.Attributes exposing (attribute)
import Iso8601
import Json.Decode as Decode
import Time exposing (Posix)
import Time.Extra as TimeE


{-| TODO: Refactor this, and make a decision if this module should exist or
not, perhaps it should just be a posix alias...
-}
type DateTime
= DateTime Posix

Expand All @@ -32,12 +34,9 @@ type DateTimeFormat
| TimeWithSeconds


{-| TODO: Refactor this, and make a decision if this module should exist or
not, perhaps it should just be a posix alias...
-}
isSameDay : Time.Zone -> DateTime -> DateTime -> Bool
isSameDay zone (DateTime a) (DateTime b) =
TimeE.diff TimeE.Day zone a b == 0
Time.toDay zone a == Time.toDay zone b && Time.toMonth zone a == Time.toMonth zone b && Time.toYear zone a == Time.toYear zone b


fromPosix : Posix -> DateTime
Expand Down

0 comments on commit b61703c

Please sign in to comment.