arrow
arrow copied to clipboard
force exact match on .get()
Issue Description
when executing the following statement:
import arrow
arrow.get('95-03-10 23:01:44','YY-M-D HH:mm:ss')
<Arrow [1995-03-10T23:01:44+00:00]>
the library returns me the date, but I gave it a single M, so it shouldn't have done the .get() but it did. one would expect it to fail, as the correct format should be 'YY-MM-D HH:mm:ss' for that same example.
I would like to know if this is a bug or is there a parameter to force the match to be exact?
System Info
- 🖥 ubuntu 18.04 32 bits
- 🐍 Python 3.8.5
- 🏹 1.2.1
Hi @jhonnattan123 this is a bug with the M
and MM
tokens, we will look into fixing it.
Hey there,
I have checked the supported tokens in the documentation. The token M
seems to be valid, so
>>> arrow.get('95-03-10 23:01:44','YY-M-D HH:mm:ss')
should not fail, but instead return (no leading zero in front of month):
<Arrow [1995-3-10T23:01:44+00:00]>
Is this conclusion correct?
Hey @ALee008 not quite.
I think you are confusing formatting where this M
would be valid. Arrow objects always store the month in zero padded form internally.