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

Default year directive is not taken into account #59

Open
ShrykeWindgrace opened this issue Sep 3, 2021 · 2 comments
Open

Default year directive is not taken into account #59

ShrykeWindgrace opened this issue Sep 3, 2021 · 2 comments

Comments

@ShrykeWindgrace
Copy link

ShrykeWindgrace commented Sep 3, 2021

Hi!

My muscle memory prefers dates in the 2021-12-31 or 12-31 format, and I am running hledger-iadd as follows:

$ hledger-iadd --completion-engine fuzzy --date-format '[%Y-]%m-%d'

The journal file (pointed by $LEDGER_FILE) contains a default year directive: Y2021.

Yet when I enter the transaction date without the year (e.g. "11-03"), but in the future (because reasons), the year suggestion is 2020; the heuristics for year suggestion goes astray. Is there a an additional configuration step for default year - to bypass that heuristics - that I missed?

Cheers!

$ hledger-iadd --version                                            
This is hledger-iadd version 1.3.14
@hpdeifel
Copy link
Owner

Yes, iadd currently ignores the default year set in the journal. The year that's suggested is based on the current date and the (incomplete) entered date. The assumption is that iadd is mostly used to record past transactions and so it will helpfully suggest the most recent matching date from the past.

I don't know how to best accommodate your use-case without breaking mine, as I exclusively enter past transactions and the current behavior is quite helpful for that. Maybe the default year could indeed be used if set, but I have a feeling that this would somewhat conflate two concepts that ought to be separate: The in-journal date format and the completion mechanism.

@ShrykeWindgrace
Copy link
Author

ShrykeWindgrace commented Sep 13, 2021

Thanks for clarifications! Indeed, current heuristics works perfectly well if we input only past transactions.

I wonder if we could a separate directive - something like {%Y}, for example - that would force current year or default year in the date suggestion. Admittedly, that's a non-zero effort for a minor gain, I will not insist on implementing this feature=)

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

2 participants