Skip to content

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

Open
@Owyn

Description

@Owyn

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions