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

Support Writing Dates As Per User Input #14

Open
the-solipsist opened this issue Jan 13, 2017 · 5 comments
Open

Support Writing Dates As Per User Input #14

the-solipsist opened this issue Jan 13, 2017 · 5 comments
Labels

Comments

@the-solipsist
Copy link

Currently I open hledger-iadd using this command:

$ hledger-iadd --date-format [[%Y-]%m-]%d -f Accounts/2017.ledger

Yet, when I look at the dates entered in the file, they always follow the Y/m/d format. Is --date-format only by hledger-iadd for reading dates, rather than for writing them? Is it possible to support writing of dats in a different format too?

@t-wissmann
Copy link
Contributor

The file format as specified by hledger restricts the date format to Y/M/D, Y-M-D, and Y.M.D: http://hledger.org/journal.html#dates
So not all date formats configurable in hledger-iadd are allowed. If hledger-iadd is made configurable for that, it should be another switch (and config option), e.g. --journal-date-format.

@hpdeifel
Copy link
Owner

Sorry I didn't respond to this earlier.

As @t-wissmann noted, only certain date formats are allowed, so this is related to simonmichael/hledger#210.

Also, we currently use the showTransaction function from hledger-lib which formats transactions like the hledger print command would. I think that's the way to go, so if we really want different formats, that should be implemented in hledger-lib.

@the-solipsist What's your use case? Do you want a completely different date format or do you just want to omit the year?

@hpdeifel
Copy link
Owner

hpdeifel commented Jan 26, 2017

As a side note, the documentation should be clearer on --date-format.

@the-solipsist
Copy link
Author

I prefer using an ISO 8601-style format of YYYY-MM-DD.

@the-solipsist
Copy link
Author

I just wanted to leave a note that this is currently waiting on simonmichael/hledger#933

hpdeifel added a commit that referenced this issue Feb 15, 2020
hledger-lib 1.17 will switch showTransaction to ISO date format, which means
that ISO dates yyyy-mm-dd will be added to the journal instead of yyyy/mm/dd.
Thus, for hledger-lib >=1.17, we also show the ISO format in the UI.

fixes #46
related #14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants