parsing: fix timelog parsing
This commit is contained in:
		
							parent
							
								
									10923f6fb1
								
							
						
					
					
						commit
						5493a604e3
					
				| @ -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 | ||||
|  | ||||
							
								
								
									
										10
									
								
								tests/timelog.test
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								tests/timelog.test
									
									
									
									
									
										Normal file
									
								
							| @ -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 | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user