mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-01 12:41:52 -07:00
Fix date parsing issue for org mode plugin
This patch fixes the date parsing issue currently when an entry like `todo +d 22 01 2022` is used. I have added tests too which demonstrate the current issue so that we can prevent future regression.
This commit is contained in:
@@ -401,6 +401,14 @@ pDate = skipSpaces *> choice
|
||||
, pPrefix "su" "nday" Sunday
|
||||
]
|
||||
|
||||
numWithoutColon :: Parser Int
|
||||
numWithoutColon = do
|
||||
str <- num
|
||||
c <- get
|
||||
if c == ':'
|
||||
then pfail
|
||||
else pure str
|
||||
|
||||
pDate' :: Parser (Int, Maybe Int, Maybe Integer)
|
||||
pDate' =
|
||||
(,,) <$> num
|
||||
@@ -411,6 +419,7 @@ pDate = skipSpaces *> choice
|
||||
, pPrefix "jul" "y" 7 , pPrefix "au" "gust" 8
|
||||
, pPrefix "s" "eptember" 9 , pPrefix "o" "ctober" 10
|
||||
, pPrefix "n" "ovember" 11, pPrefix "d" "ecember" 12
|
||||
, numWithoutColon
|
||||
])
|
||||
<*> optional (skipSpaces *> num >>= \i -> guard (i >= 25) $> i)
|
||||
|
||||
|
Reference in New Issue
Block a user