From d27f521e754f52f8eb39c04f319a748a20806beb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20Sch=C3=B6ttl?= Date: Sat, 8 Feb 2020 14:06:52 +0100 Subject: [PATCH] Fix documentation, make ISO date format standard in some places --- hledger-lib/Hledger/Data/Dates.hs | 2 +- hledger-lib/Hledger/Data/Transaction.hs | 6 +++--- hledger-lib/Hledger/Read/Common.hs | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hledger-lib/Hledger/Data/Dates.hs b/hledger-lib/Hledger/Data/Dates.hs index 13e2059a7ab..fb0a6132d9c 100644 --- a/hledger-lib/Hledger/Data/Dates.hs +++ b/hledger-lib/Hledger/Data/Dates.hs @@ -775,7 +775,7 @@ datesepchar :: TextParser m Char datesepchar = satisfy isDateSepChar isDateSepChar :: Char -> Bool -isDateSepChar c = c == '/' || c == '-' || c == '.' +isDateSepChar c = c == '-' || c == '/' || c == '.' validYear, validMonth, validDay :: String -> Bool validYear s = length s >= 4 && isJust (readMay s :: Maybe Year) diff --git a/hledger-lib/Hledger/Data/Transaction.hs b/hledger-lib/Hledger/Data/Transaction.hs index 2c40f4ef6b2..119c647227a 100644 --- a/hledger-lib/Hledger/Data/Transaction.hs +++ b/hledger-lib/Hledger/Data/Transaction.hs @@ -127,12 +127,12 @@ payeeAndNoteFromDescription t (p, n) = T.span (/= '|') t {-| -Render a journal transaction as text in the style of Ledger's print command. +Render a journal transaction as text similar to the style of Ledger's print command. -Ledger 2.x's standard format looks like this: +Adapted from Ledger 2.x and 3.x standard format: @ -yyyy/mm/dd[ *][ CODE] description......... [ ; comment...............] +yyyy-mm-dd[ *][ CODE] description......... [ ; comment...............] account name 1..................... ...$amount1[ ; comment...............] account name 2..................... ..$-amount1[ ; comment...............] diff --git a/hledger-lib/Hledger/Read/Common.hs b/hledger-lib/Hledger/Read/Common.hs index e05bda23b07..fe2808f31dd 100644 --- a/hledger-lib/Hledger/Read/Common.hs +++ b/hledger-lib/Hledger/Read/Common.hs @@ -403,8 +403,8 @@ descriptionp = takeWhileP Nothing (not . semicolonOrNewline) --- ** dates --- | Parse a date in YYYY/MM/DD format. --- Hyphen (-) and period (.) are also allowed as separators. +-- | Parse a date in YYYY-MM-DD format. +-- Slash (/) and period (.) are also allowed as separators. -- The year may be omitted if a default year has been set. -- Leading zeroes may be omitted. datep :: JournalParser m Day @@ -456,8 +456,8 @@ datep' mYear = do {-# INLINABLE datep' #-} --- | Parse a date and time in YYYY/MM/DD HH:MM[:SS][+-ZZZZ] format. --- Hyphen (-) and period (.) are also allowed as date separators. +-- | Parse a date and time in YYYY-MM-DD HH:MM[:SS][+-ZZZZ] format. +-- Slash (/) and period (.) are also allowed as date separators. -- The year may be omitted if a default year has been set. -- Seconds are optional. -- The timezone is optional and ignored (the time is always interpreted as a local time).