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

fallback timezone for parse() should be local timezone not UTC #204

Open
Owyn opened this issue Aug 3, 2024 · 0 comments
Open

fallback timezone for parse() should be local timezone not UTC #204

Owyn opened this issue Aug 3, 2024 · 0 comments

Comments

@Owyn
Copy link

Owyn commented Aug 3, 2024

Is your Feature Request related to a problem? Please describe.

Trying to parse ebay item dates, e.g.
Aug-3 12:23, but it considers them UTC 0

Describe the solution you'd like
When there is no timezone clearly specified - use local timezone

Describe alternatives you've considered
I have tried:

print(datetime.datetime.now(datetime.timezone(datetime.timedelta(0))).astimezone().tzinfo)
RTZ 2 (зима)

maya.parse(item_date, print(datetime.datetime.now(datetime.timezone(datetime.timedelta(0))).astimezone().tzinfo), true).datetime().isoformat()

but RTZ is not supported

maya.parse(item_date, "UTC"+time.strftime("%z"), true).datetime().isoformat()
and
maya.parse(item_date, "UTC"+time.strftime("%z").replace("0",""), true).datetime().isoformat()

but both UTC+0300 and UTC+3 formats also aren't supported

Additional context
maybe add "Local" timezone value to use at least? but I still think it should use the local one when there is none specified

from tzlocal import get_localzone

maya.parse(item_date, get_localzone().key)
maya.when(item_date, get_localzone().key)

worked for me in the end

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

1 participant