Restrict supported date interval
Opened this issue · 4 comments
superbobry commented
It looks like strptime
and strftime
behaviour for dates before 1900 varies across platforms, so I think we should throw an error on such inputs.
(tempo_dev@yooki)13> tempo:parse(<<"%Y">>, {unix, <<"1505">>}). %% OS X
{error,format_mismatch}
si14 commented
Besided undefined behaviour there is an obvious bug there:
(tempo_dev@si14-laptop)6> tempo:parse(<<"">>, <<"">>, unix).
{ok,0.0} <---- WAT
(tempo_dev@si14-laptop)7> tempo:parse(<<"%Y">>, {unix, <<"1505">>}).
{ok,-14674003200.0}
superbobry commented
What kind of behaviour would you expect? I'd say badarg
for both of them.
si14 commented
Yup.
superbobry commented
The first case is fixed in 593cd5c, the latter is hard to validate, unfortunately. Any suggestions?