Dates in international standard format are wrongly interpreted

Bug #792321 reported by Gareth Rees
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PyEphem
Fix Released
Undecided
Unassigned

Bug Description

PyEphem's Date class appears to accept dates in international standard (ISO 8601) format, but in fact it mis-interprets them. For example,

>>> from ephem import *
>>> Date('2011-05-04')
2010/6/26 00:00:00

It would be nice if international standard dates were accepted, but if this is not possible, then it would be better if incorrectly formatted dates caused an exception (e.g. ValueError) to be raised rather than being silently accepted but mis-interpreted.

See this question on Stack Overflow <http://stackoverflow.com/questions/5881897/how-to-calculate-longitude-using-pyephem> for an example of a user who has got into difficulties because of this feature.

Revision history for this message
Brandon Rhodes (brandon-rhodes) wrote :

The underlying astronomy library thought that minus signs were useful for arithmetic (!), so "1999-05" means "five months before the beginning of 1999." I have removed this distinction in my version of the library so they are now simply a separator, exactly as you suggest. I am releasing 3.7.5.1 tonight that incorporates this improvement. Thank you!

Changed in pyephem:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.