hl7apy icon indicating copy to clipboard operation
hl7apy copied to clipboard

Error encoding dates before 1900

Open svituz opened this issue 10 years ago • 0 comments

Description

If the value of an element of type DTM is before 1900, calling the method to_er7() raises an error

How to reproduce

Create a DTM object with the year before 1900 and call to_er7() on it

d = DTM( datetime.date(1800, 12, 20) )
d.to_er7()

What happens

It raises

ValueError: year=1800 is before 1900; the datetime strftime() methods require year >= 1900

What should happen

It should return the correct ER7 representation of the DTM object

Notes

  • It happens also with DT objects
  • The error is raised by strftime which doesn't support years before 1900

svituz avatar Jul 16 '14 08:07 svituz