Open etienne-monier opened 4 years ago
@etienne-monier I've never tried this, but you could try setting the environment variable LEDGER_DATE_FORMAT="%d/%m/%Y'.
Hi, This does not work.
I had forgotten to tell you I've got a .ledgerrc
file which contains:
--file ***/personal.ledger
--pedantic
--input-date-format %d/%m/%Y
--date-format %d/%m/%Y
It seems this is read when calling ledger-autosync file.ofx
as I do not give the file. Instead, it reads the file specified by .ledgerrc
.
Yes, that's right, ledger-autosync
parses .ledgerrc
, but only the --file
argument. It would be pretty easy (I think) to use the --date-format
argument in ledger-autosync
to pass on as --date-format
to ledger. @kevinjfoley wrote that code, I'm not sure the ins and outs of that.
Ok for the file.
The ledger --date-format
is for output date format only. To specify the file format, I must use --input-date-format
.
Similarly, @kevinjfoley 's implementation only permit to format the output of ledger-autosync. In his pull request, you told that was rare to use different date formatting, but that is not in France :D
I'll have a look at that, but I think for the moment to use a small script to toogle the file date format. I've got a PhD thesis to write :s
:) I see no reason why Kevin's implementation can't be extended to pass --input-date-format
to ledger as well. In fact, it seems to me that if you want --date-format
set you want --input-date-format
set as well. But perhaps @kevinjfoley knows more.
I think it will require a bit of work since it will have to pass the parameter through to a completely different place (multiple place actually, one for each MetaLedger
).
However I don't think it should be too difficult, I'll try to open a PR to address when I have some time this week.
I can take a look at it, I just wanted to check in to make sure that it made sense to you!
No problem, I don't mind looking either! But yeah I think the two changes will be largely unrelated other than sharing a parameter (though I only have a cursory knowledge of the code base).
it seems to me that if you want --date-format set you want --input-date-format set as well
This is probably true 99.99% of the time but I wouldn't be surprised if someone has a use case where it isn't true. Might be worth it to have --input-date-format
as optional, and use date-format
for when input-date-format
isn't set.
Hi,
I use dd/mm/yyyy format in my ledger file. I saw this pull which introduced date formatting for output string.
My problem occurs before and the output looks like ...
I installed dev source to have output date format handling.
I use ̀--input-date-format %d/%m/%Y` option in ledger, but this does not exists for ledger-autosync.
Do you have an idea for me ? Is there something I misunderstood ?