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

day_first parse when year_first format does nothing? #201

Open
Owyn opened this issue Jan 21, 2024 · 1 comment
Open

day_first parse when year_first format does nothing? #201

Owyn opened this issue Jan 21, 2024 · 1 comment

Comments

@Owyn
Copy link

Owyn commented Jan 21, 2024

Describe the bug
Can't get it to parse as american time when the year is written first

Environment and Version

  • OS (incl. terminal and shell used): Win 10
  • Python Version: 3.10.1
  • maya Version: 0.6.1
  • Your timezone: GMT+3

To Reproduce

>>> maya.parse("2024-01-12 17:13:51", "UTC", True).datetime()
datetime.datetime(2024, 1, 12, 17, 13, 51, tzinfo=<UTC>)
>>> maya.parse("2024-01-12 17:13:51", "UTC", False).datetime()
datetime.datetime(2024, 1, 12, 17, 13, 51, tzinfo=<UTC>)

Expected behavior
A way to make it parse 2024-01-12 as 1st of December, not 12th of January

@FluffyDietEngine
Copy link

This date format, "YYYY-DD-MM", is not under either ISO 8601 or RFC 3339 date formats. This is the main reason it is being interpreted as "YYYY-MM-DD" instead of expected "YYYY-DD-MM".

Upstream library pendulum have capability of passing format along with the string to parse. This feature can be integrated here to enhance the possibilities.

>>> import pendulum
>>> dt = pendulum.from_format('1975-05-21 22', 'YYYY-MM-DD HH')
>>> print(dt)
'1975-05-21T22:00:00+00:00'

This can be a major enhancement to let the user mention the format to be parsed on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants