-
-
Notifications
You must be signed in to change notification settings - Fork 322
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
Replace YYYY/MM/DD with YYYY-MM-DD in all documentation and in all printing commands #933
Comments
I too prefer yyyy-mm-dd format and would like to see this. I'd even be happy with a non-breaking change for this, such as a configuration option (does hledger support or plan to support rc files?). |
I've added a comment to #210. With regard to output from all hledger tools, and all docs, I agree that we should switch to ISO YYYY-MM-DD as the default/preferred date format. There's still the question of whether to always show leading zeros, eg 0001-01-01 not 1-1-1, I'm not sure if the latter would ever be preferable; probably not. I feel adding options or a config file are a last resort, to be avoided unless really needed. |
Trying to focus this issue more on the output side, with #210 covering input. "Documentation" of course involves both input and output examples. What does "using rewrite in a automated fashion" mean - parsing hledger's output ? That's not a supported API (unlike hledger-api) and I'm not expecting this issue to cause too much compatibility pain. |
From #210:
I suppose you're right. If ISO dates in output are really a problem for people ? Ledger calls it --date-format. |
I'm strongly for always showing leading zeros in ISO dates. Because that is what makes ISO dates and also they are not sortable otherwise. I think I'll get used to the dash version. But aren't there downsides of changing the hledger journal format and going different ways than the ledger file format? Compatibility? I'm new to hledger and don't know legder. This are just my considerations. I think an |
I'd definitely always show leading zeros. This ensures that also people unfamiliar with this format can easily pick up which number is the year. Also, removing the leading zeros is not ISO8601 compliant.
E.g. having git hooks to always use |
That's a topic for #210, but that's not really a problem as the hledger journal format (and I assume Ledger's before it) already allow ISO dates. |
Most people I know in Germany would never write down an ISO date and almost never read ISO dates (except in some IT professions). When I show hledger reports to people - clerks or customers - I'm pretty sure they are unsettled by the ISO dates. Especially customers are already demanded by the many numbers ;) |
I think it best to have input data in the YYYY-MM-DD (ISO8601) format, and that be the default in documentation and print commands. However, perhaps, there ought to be a way to create reports in other custom date formats (like DD/MM/YYYY or DD.MM.YYYY, which seem to be the most popular formats in countries like India and Germany)? Of course, one potential argument against this would be that people can use |
I'm a bit confused about the scope of this issue. Imo, the internal date format should be the international standardized ISO 8601 (referenced here as "ISO format"). This means, the journal file should use this notation, as well as all in- and output. Is this how it's meant to be ? |
Yes, we've agreed on #210, and here,
1 was covered by #210 and is the status quo; this issue, #933, will cover at least 2 and 3. |
@simonmichael I've been thinking about this a little more and I still wonder if it's a good idea that Hledeger supports
|
I hear you but I'm not convinced. D/M/Y is the norm in Ireland, eg. I suspect https://en.wikipedia.org/wiki/Date_format_by_country will confirm that the punctuation character can't be relied on as a guide. |
Yeah, true. But that is basically confiriming that Hledger should print a warning whenever the format is not YYYY-MM-DD, right? |
I don't think it's causing enough trouble to be worth the annoyance of a warning, is it ? |
Mh. Ok I guess there is little ambiguity with
This could mean anything otherwise and is really bad practice. |
Yes, I can see that requiring a four digit year could make sense. On the other hand it's an easy mistake to notice and fix, and if some users are really attached to a two-digit year format I'm not sure we should deny them. Like Ledger, we also allow yearless dates (11/12) which again can be misinterpreted. Re warnings generally, we have so far resisted adding any; we have errors that stop the program, but not warnings, which keeps our output very predictable and avoids the need for more infrastructure to control and customise the warnings. I'm not sure if we should add warnings to hledger, or if we should keep them confined in some kind of lint command. |
Haha, that's not the kind of reasoning I'd expect from a Haskell developer. Sounds like: "Null / undefined / NaN is easy to fix. If some developers are attached to it, they should be able to use it" 😛 I think it should be warned about …
But how can yearless dates be used in meaningful way? Sounds like it's only useful for short example journals.
They are just printed to stderr and normally are a non-braking change. So the impact should be really low, right?
That would be a good start already! |
The year for yearless dates can be set by a preceding directive in the ledger file. I think a short warning message wouldn't be so bad. I think like ad-si that the risk and impact of this kind of error is high. But please no warning for dates with 4-digit-years. Concerning warnings about yearless dates, I'm unsure. Keep in mind that a warning have to be at the end of the normal output to be visible. And the warning would not be visible in a pager like less. |
Right now I'll just say that we chose to be highly compatible with Ledger from the outset, which dictated many things. If you were designing a format from scratch intended for maximum error prevention and "educating" users, some things would be different. And there's nothing stopping that! But the |
... that's why I created Transity. ISO 8601 in UTC only and all error detection features are activated per default 😉. So yeah, I understand if you don't want to go all the way, just sharing my 2 cents here. |
I know @simonmichael is leaning against configuration and options but I'd add that - warnings are generally OK for risky situations, like yearless dates and xx/yy/zz date format. But only if a date format is not specified earlier (in option or configuration ;). |
@mistery I hear you. Warnings (and config files) aren't out of the question, but they require strong justification. If you run into concrete examples where hledger's current behaviour caused you a real problem, do share them (but as a new issue please - let's refocus this one). |
Status: #933 (comment) |
Any news on this issue? |
Negative. Would you be interested to help out ? |
Sorry. I do not code Haskell |
No problem, but if you'd ever like to learn, come on by #hledger to find help. |
Update: #1157 has implemented YYYY-MM-DD output, more testers welcome. |
Is there currently in |
Currently: no, there really isn't. Guess we need someone to work on that --output-date-format.. |
Sorry, I have a question on the status. In current hledger (version 1.16) at least The program buchhaltung still generates the old format despite I updated its dependenciest in compiled/installed it... Edit: @simonmichael thanks, my fault. I have the release installed and the git version. The git version was first on the path... |
@schoettl I don't think this change is in any 1.16* version. |
Perhaps the title of this issue should be changed to "add customization of date output format" to more accurately reflect what's remaining to be done? |
I suggest we limit this issue's scope again: it was about switching to ISO format, and that's done except for consideration and possible action on
For other things above (--output-date-format, possible warnings/more strict behaviour when parsing ambiguous dates, ...) let's open new PRs when someone is ready to work on them. |
This has already been mentioned in #210, but there has been no further progress since then, so I wanted to pick it up again.
Is there still any discussion needed that this is the right way to go?
Otherwise I'd skip that part and gather a TODO list 😅:
Change output of
hledger print
hledger rewrite
hledger add
hledger balancesheet
hledger close
hledger register
hledger print-unique
hledger register-match
Did I miss something?
hledger stats
already uses the ISO format.If somebody is using rewrite in a automated fashion or similar, this would be a severe breaking change.
So maybe introduce the feature via a config flag first and issue a warning for all commands, that the default will change in the future and that in order to keep the current formatting one needs to add the config flag (e.g.
hledger --output-date-format yyyy/mm/dd rewrite
)?I'd be happy to create a PR as soon as we're in agreement how this should be handled.
Looking forward to your feedback!
The text was updated successfully, but these errors were encountered: