diff --git a/Ledger/Parse.hs b/Ledger/Parse.hs index 5dcf19c58..ef9ca9fe3 100644 --- a/Ledger/Parse.hs +++ b/Ledger/Parse.hs @@ -345,6 +345,7 @@ ledgerpartialdate = do ledgerdatetime :: GenParser Char LedgerFileCtx LocalTime ledgerdatetime = do day <- ledgerdate + many1 spacenonewline h <- many1 digit char ':' m <- many1 digit @@ -553,9 +554,8 @@ timelogentry = do code <- oneOf "bhioO" many1 spacenonewline datetime <- ledgerdatetime - many1 spacenonewline - comment <- liftM2 (++) getParentAccount restofline - return $ TimeLogEntry (read [code]) datetime comment + comment <- optionMaybe (many1 spacenonewline >> liftM2 (++) getParentAccount restofline) + return $ TimeLogEntry (read [code]) datetime (fromMaybe "" comment) -- misc parsing diff --git a/tests/timelog.test b/tests/timelog.test new file mode 100644 index 000000000..f2739cad1 --- /dev/null +++ b/tests/timelog.test @@ -0,0 +1,10 @@ +-f - print +<<< +i 2009/1/1 08:00:00 x +o 2009/1/1 09:00:00 + +>>> +2009/01/01 * 08:00-09:00 + x 1.0h + +>>>2