kendricktan / ledger-analytics

Easy to use analytics/visualization tool for ledger-cli
https://kndrck.co/posts/ledger-analytics/
MIT License
296 stars 15 forks source link

how to change the input date format? #4

Closed rohieb closed 6 years ago

rohieb commented 6 years ago

When I start the script with node ledger-analytics.js -f journal.ledger and browse to localhost:3000, I only get an error message in the browser:

Unable to fetch bar chart data (try changing your base currency/commodity)

and on the console I see a lot of errors from ledger:

Error: Year is out of valid range: 1400..10000

Normally I'm using ledger-cli with --input-date-format "%d.%m.%y", is there a way to specify it in the script?

Here is a MWE (in German) for testing:

$ cat ~/tmp/test.ledger 
account Aufwendungen:Lebensmittel:Restaurants
account Vermögen:Bargeld

commodity €
    format 1000.00€
    default

23.02.18 * asia hung
    Aufwendungen:Lebensmittel:Restaurants                   8.00€
    Vermögen:Bargeld

$ ledger bal -f ~/tmp/test.ledger --input-date-format "%d.%m.%y"
               8.00€  Aufwendungen:Lebensmittel:Restaurants
              -8.00€  Vermögen:Bargeld
--------------------
                   0
kendricktan commented 6 years ago

Just added it to master branch. https://github.com/kendricktan/ledger-analytics/commit/fe1e6a5fcd900960beb3d4f3df334505ae0423de

I'm still integrating CI and testing so I won't be pushing to NPM for a while. You can build and install the version with extra args by cloning the folder, and running

npm install
npm run build
npm install -g .
ledger-analytics -f /tmp/test.ledger --input-date-format "%d.%m.%y"

:smile:

rohieb commented 6 years ago

Thanks! That's exactly how I was thinking today of solving it :)

kendricktan commented 6 years ago

@rohieb there was a bug in the master branch, I've now pushed the latest working version (with the extra commands for ledger) onto npm now :slightly_smiling_face:

Should be v0.1.5a