Closed 5j9 closed 2 years ago
I confirm that jdatetime.datetime.strptim
cannot handle %y
.
Would you like to prepare a patch and fix it?
I just noticed that it is more complicated than just using the current century:
>>> datetime.datetime.strptime('68/1/1', '%y/%m/%d')
datetime.datetime(2068, 1, 1, 0, 0)
>>> datetime.datetime.strptime('69/1/1', '%y/%m/%d')
datetime.datetime(1969, 1, 1, 0, 0)
CPython follows the Open Group specification (IEEE Std 1003.1-2001). See https://github.com/python/cpython/blob/f4c03484da59049eb62a9bf7777b963e2267d187/Lib/_strptime.py#L377 .
I am not sure what would be the appropriate range for Jalali dates here.
Not sure! We can consider [00, 68] in century 1400 and [69,99] in the century 1300. Or consider all of them in century 1400. @slashmili @farzadghanei What do you think?
the spec is absurd and unreasonable . Anyway I think this is an ok solution:
We can consider [00, 68] in century 1400 and [69,99] in the century 1300.
Expected output:
jdatetime.datetime(1400, 1, 1, 0, 0)
(use the first two digits of the current century to interpret00
)runtime information