alexprengere / currencyconverter

A Python currency converter using the European Central Bank data.
http://alexprengere.github.io/currencyconverter
Apache License 2.0
215 stars 59 forks source link

Allow for dates from non-English locales. #53

Closed edward-dauvergne closed 6 months ago

edward-dauvergne commented 6 months ago

For example the date '05 April 2024' is sometimes encountered, but this cannot be parsed. This is a very simple fix, if using the dateutil package is acceptable.

alexprengere commented 6 months ago

Introducing a new dependency for a niche use case would be overkill. Having 0 dependencies is actually a big feature, as it allows for easy deployment in a variety of use cases. Also the tests are failing because you did not declare the dateutil dependency in the setup.cfg.

We could have an "extra dependency group" added just for the command-line interface, that would include dateutil and thus allow to parse more dates. But again this would increase complexity.

Note that the parsing of "%d %B %Y" is not fortuitous, it is the format used by the ECB for single-date data source.

edward-dauvergne commented 6 months ago

I just downloaded the ECB file, and the data I see today looks like this:

Date, USD, JPY, BGN, CZK, DKK, GBP, HUF, PLN, RON, SEK, CHF, ISK, NOK, TRY, AUD, BRL, CAD, CNY, HKD, IDR, ILS, INR, KRW, MXN, MYR, NZD, PHP, SGD, THB, ZAR, 05 April 2024, 1.0841, 164.10, 1.9558, 25.286, 7.4590, 0.85773, 390.10, 4.2835, 4.9677, 11.5260, 0.9793, 150.30, 11.6118, 34.6312, 1.6461, 5.4633, 1.4702, 7.8421, 8.4868, 17192.63, 4.0725, 90.3283, 1464.09, 17.9104, 5.1462, 1.8001, 61.268, 1.4608, 39.743, 20.1710,

So I don't know what is happening. Maybe they had a bad Friday ;)