From edcfd2abb18fa8c80ef8e5ef1227077369893cbc Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 5 Mar 2013 02:08:53 +0000 Subject: [PATCH] add: handle partial dates on the command line, instead of failing after all data entry --- hledger/Hledger/Cli/Add.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hledger/Hledger/Cli/Add.hs b/hledger/Hledger/Cli/Add.hs index a8eeeec6c..26e5787a5 100644 --- a/hledger/Hledger/Cli/Add.hs +++ b/hledger/Hledger/Cli/Add.hs @@ -103,8 +103,10 @@ getTransactionOrRestart j opts defdate moredefs = do || s == "." || isRight (parseWithCtx nullctx dateandcodep $ lowercase s)) when (datecodestr == ".") $ ioError $ mkIOError eofErrorType "" Nothing Nothing + today <- getCurrentDay let (sdate,code) = fromparse $ parseWithCtx nullctx dateandcodep datecodestr - datestr = showDate $ fixSmartDate (parsedate defdate) sdate + defday = fixSmartDate today $ fromparse $ (parse smartdate "" . lowercase) defdate + datestr = showDate $ fixSmartDate defday sdate let (defdesc, moredefs') = headTailDef "" moredefs desc <- runInteractionDefault $ askFor "description" (Just defdesc) Nothing