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

Make YYYY-MM-DD the default date-format #48

Open
mefromthepast opened this issue Nov 10, 2020 · 4 comments
Open

Make YYYY-MM-DD the default date-format #48

mefromthepast opened this issue Nov 10, 2020 · 4 comments

Comments

@mefromthepast
Copy link

hledger has switched to it as its default date format, so I would welcome if hledger-iadd would support it as well.

DD, MM-DD, or YYYY-MM-DD respectively, with the option to skip leading 0s just as hledger-iadd is working right now with YYYY/MM/DD.

@hpdeifel
Copy link
Owner

This should already be supported by using --date-format '[[%y-]%m-]%d' or the config option date-format = '[[%y-]%m-]%d'.

We should make it the default now that hledger switched, but that would break people's muscle memory. Unfortunately, the current date parser in iadd doesn't support accepting - or / as separator, you have to choose one.

@the-solipsist
Copy link

I think it would be useful to note for others who see this issue that what is currently not supported is manually entering dates in YYYY-MM-DD format in the Date field in hledger-iadd.

But when dates that are added in YYYY/MM/DD format in hledger-iadd, it automatically ends up in the journal file as YYYY-MM-DD even though visually in hledger-iadd it shows YYYY/MM/DD.

@hpdeifel
Copy link
Owner

hpdeifel commented Jul 9, 2021

I think it would be useful to note for others who see this issue that what is currently not supported is manually entering dates in YYYY-MM-DD format in the Date field in hledger-iadd.

Sure it's possible with the config option or command line flag, see my comment above.

But when dates that are added in YYYY/MM/DD format in hledger-iadd, it automatically ends up in the journal file as YYYY-MM-DD even though visually in hledger-iadd it shows YYYY/MM/DD.

hledger-add always shows a preview of the date in hledger's default format. So you should by default see YYYY-MM-DD everywhere execpt the input itself. With the above mentioned config, not even there.

The problem here is not that it's not supported, but that it's not the default. However, this can't easily be changed in a backwards compatible way and I'd like to avoid breaking existing users muscle memory.

@hpdeifel hpdeifel changed the title Support ISO 8601 Make YYYY-MM-DD the default date-format Jul 9, 2021
@the-solipsist
Copy link

Thanks for that clarification, and correcting the issue title! I misread this:

the current date parser in iadd doesn't support accepting - or / as separator, you have to choose one.

I didn't realize it meant "the current date parser doesn't support accepting both - and / as separators: you have to choose one or the other." But your subsequent reply makes this clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants