tempo icon indicating copy to clipboard operation
tempo copied to clipboard

Restrict supported date interval

Open superbobry opened this issue 13 years ago • 4 comments

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}

superbobry avatar Aug 13 '12 20:08 superbobry

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}

si14 avatar Oct 30 '12 16:10 si14

What kind of behaviour would you expect? I'd say badarg for both of them.

superbobry avatar Oct 30 '12 20:10 superbobry

Yup.

si14 avatar Jan 06 '13 11:01 si14

The first case is fixed in 593cd5c38ca65d4f82c5182e1656af0d49f4958a, the latter is hard to validate, unfortunately. Any suggestions?

superbobry avatar Jan 06 '13 11:01 superbobry