Open setiat opened 2 years ago
Hi @setiat, you have 3 fractional seconds in time you want to parse: "010" but in 'format string' you are using only 2: "SS"
I think that's why it behaves incorrectly, you get wrong DateTime object
Thanks @Renkoru
Do you know if there is any way parse fractional seconds on any length in pendulum?
@setiat, I think in your case you could try to use parse
>>> import pendulum as p
>>> dt = p.parse("13:00:00.010")
>>> dt
DateTime(2021, 11, 12, 13, 0, 0, 10000, tzinfo=Timezone('UTC'))
>>> dt.format("SS")
'01'
>>> dt = p.parse("13:00:00.001")
>>> dt
DateTime(2021, 11, 12, 13, 0, 0, 1000, tzinfo=Timezone('UTC'))
Issue
Consider the example below:
shouldn't the result be
test.format("SS")
return01
?