Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix documentation, make ISO date format standard in some places #1186

Merged
merged 1 commit into from
Feb 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hledger-lib/Hledger/Data/Dates.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions hledger-lib/Hledger/Data/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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...............]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not correct I think, both Ledger 2 and 3 print dates with slashes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right. But this is the documentation for the showTransaction function, so we also have to fix the sentence above my change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the above part of comment.

account name 1..................... ...$amount1[ ; comment...............]
account name 2..................... ..$-amount1[ ; comment...............]

Expand Down
8 changes: 4 additions & 4 deletions hledger-lib/Hledger/Read/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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).
Expand Down