Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

force exact match on .get() #1084

Open
jhonnattan123 opened this issue Jan 13, 2022 · 3 comments · May be fixed by #1142
Open

force exact match on .get() #1084

jhonnattan123 opened this issue Jan 13, 2022 · 3 comments · May be fixed by #1142
Labels

Comments

@jhonnattan123
Copy link

jhonnattan123 commented Jan 13, 2022

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
@systemcatch
Copy link
Collaborator

Hi @jhonnattan123 this is a bug with the M and MM tokens, we will look into fixing it.

@ALee008
Copy link
Contributor

ALee008 commented Jun 9, 2022

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?

@systemcatch
Copy link
Collaborator

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.

@13MK3 13MK3 linked a pull request Nov 14, 2022 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants