ixc / python-edtf

MIT License
52 stars 19 forks source link

Later values can sometimes be earlier than the early values #33

Open markfinger opened 4 years ago

markfinger commented 4 years ago

'c.1900-100' results in latest values that are earlier than the early values.

In [8]: from edtf.convert import jd_to_struct_time

In [9]: jd_to_struct_time(w.creation_date_earliest) Out[9]: time.struct_time(tm_year=1900, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=0, tm_yday=0, tm_isdst=-1)

In [10]: jd_to_struct_time(w.creation_date_earliest_fuzzy) Out[10]: time.struct_time(tm_year=1899, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=0, tm_yday=0, tm_isdst=-1)

In [11]: jd_to_struct_time(w.creation_date_latest) Out[11]: time.struct_time(tm_year=100, tm_mon=12, tm_mday=31, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=0, tm_yday=0, tm_isdst=-1)

In [12]: jd_to_struct_time(w.creation_date_latest_fuzzy) Out[12]: time.struct_time(tm_year=100, tm_mon=12, tm_mday=31, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=0, tm_yday=0, tm_isdst=-1)

In [13]: w.creation_date_display Out[13]: 'c.1900-100'

markfinger commented 4 years ago

Another example:

[w.creation_date_display, jd_to_struct_time(w.creation_date_earliest), jd_to_struct_time(w.creation_date_earliest_fuzzy), jd_to_struct_time(w.creation_date_latest), jd_to_struct_time(w.creation_date_latest_fuzzy)]
['1880-914',
 time.struct_time(tm_year=1880, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=0, tm_yday=0, tm_isdst=-1),
 time.struct_time(tm_year=1880, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=0, tm_yday=0, tm_isdst=-1),
 time.struct_time(tm_year=914, tm_mon=12, tm_mday=31, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=0, tm_yday=0, tm_isdst=-1),
 time.struct_time(tm_year=914, tm_mon=12, tm_mday=31, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=0, tm_yday=0, tm_isdst=-1)]