Previously, strptime worked greedily. That is, specifiers like %Y
matched as many ASCII digits as possible, and then tried to parse all
of them into a year value.
But this meant that using %Y%m%d to parse something like 20240730
couldn't work: %Y would consume all of 20240730 and then of course
fail since the value exceeds the year boundaries of Jiff.
Instead, we tweak how parsing works so that it only consumes the
maximum possible number of digits given its boundaries.
Previously,
strptime
worked greedily. That is, specifiers like%Y
matched as many ASCII digits as possible, and then tried to parse all of them into a year value.But this meant that using
%Y%m%d
to parse something like20240730
couldn't work:%Y
would consume all of20240730
and then of course fail since the value exceeds the year boundaries of Jiff.Instead, we tweak how parsing works so that it only consumes the maximum possible number of digits given its boundaries.
Fixes #62