X.P.OrgMode: Fallback to "today" if no day is given

This commit is contained in:
Tony Zorman
2024-03-29 11:02:41 +01:00
parent 8ac84079a2
commit d691d25d1c
2 changed files with 10 additions and 4 deletions

View File

@@ -56,6 +56,11 @@ spec = do
(Time {date = Date (22, Just 1, Just 2021), tod = Just $ TimeOfDay 1 1})
B
)
it "parses no day as today when given a time" $ do
pInput "todo +s 12:00"
`shouldBe` Just (Scheduled "todo" (Time {date = Today, tod = Just $ TimeOfDay 12 0}) NoPriority)
pInput "todo +d 14:05 #B"
`shouldBe` Just (Deadline "todo" (Time {date = Today, tod = Just $ TimeOfDay 14 5}) B)
context "no priority#b" $ do
it "parses to the correct thing" $
@@ -179,7 +184,7 @@ instance Arbitrary Date where
[ pure Today
, pure Tomorrow
, Next . toEnum <$> choose (0, 6)
, do d <- posInt
, do d <- posInt `suchThat` (<= 31)
m <- mbPos `suchThat` (<= Just 12)
Date . (d, m, ) <$> if isNothing m
then pure Nothing