Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timestring: work around 29th February bug #181

Closed
GraemeWatt opened this issue Feb 29, 2020 · 0 comments
Closed

timestring: work around 29th February bug #181

GraemeWatt opened this issue Feb 29, 2020 · 0 comments

Comments

@GraemeWatt
Copy link
Member

GraemeWatt commented Feb 29, 2020

The timestring.Date function is currently called in four places:

return timestring.Date(datafield.find_all(code=code)[0].string).year

return date, timestring.Date(date).year

year = timestring.Date(record['creation_date']).year

year = timestring.Date(record['creation_date']).year

There is a bug when timestring.Date is called on 29th February and the year passed is not a leap year:

>>> import timestring
>>> timestring.Date("2001-07-01")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/graemewatt/.virtualenvs/hepdata/lib/python2.7/site-packages/timestring/Date.py", line 150, in __init__
    new_date = new_date.replace(year=year)
ValueError: day is out of range for month

This bug should be worked around or the dependence on timestring.Date removed.

See also codecov/timestring#38, codecov/timestring#39, codecov/timestring#62, codecov/timestring#63.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant