hpdeifel / hledger-iadd

A terminal UI as drop-in replacement for hledger add.
BSD 3-Clause "New" or "Revised" License
77 stars 8 forks source link

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

Open mefromthepast opened 3 years ago

mefromthepast commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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.

the-solipsist commented 3 years ago

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.