Closed joe-fennell closed 3 years ago
Thank you for reporting this - I hadn't noticed this.
In #81 I've changed this to require that the date is passed as an ISO 8601 format date - ie. something like 2020-01-05 14:56:34
. I think that is now un-ambiguous, and easier than passing each component separately.
I've just realised that I need to add better error-handling for this - so I'll do that in a separate PR.
I'm aiming to do a new release in the next few days, but in the meantime you can install from Github if necessary.
This is now fixed in v1.9.0, which has just been released to PyPI. Conda packages will follow shortly.
In Geometry.from_time_and_location the datetutil parser is configured with the 'dayfirst' flag which leads to ambiguity in parsing date and datetime strings.
This means that if you pass an unambiguous date string in iso format (e.g. 2020-01-31T...) it is interpreted as YYYY-MM-DD... but if you pass an ambiguous date string (e.g. 2020-02-01T...) it is interpreted as YYYY-DD-MM.
This is probably not the behaviour most people are expecting (i.e. it should always be interpreted in the same order). Might be better to replace datestring kwarg with separate components e.g. Geometry.from_time_and_location(year=2020, month=12, day=1, ...) and let the user handle their own string parsing.