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

incorrect tzinfo when arrow.get() #1153

Open
da-head0 opened this issue Apr 27, 2023 · 4 comments
Open

incorrect tzinfo when arrow.get() #1153

da-head0 opened this issue Apr 27, 2023 · 4 comments
Labels

Comments

@da-head0
Copy link

da-head0 commented Apr 27, 2023

Issue Description

when I add tzinfo as

end_time_as_cron = '1 10 4 3 *' # linux cron expression
arrow.get(end_time_as_cron, 'm H D M [*]', tzinfo='ASIA/Seoul')

the result is

end time:  0001-03-04T10:01:00+08:27:52

The timezone is not +09:00.

System Info

  • 🖥 OS name and version: MacOS 12.3. and jupyter notebook 6.5.4-->
  • 🐍 Python version: Python 3.10.8
  • 🏹 Arrow version: 1.2.3

Thanks in advance.

@da-head0 da-head0 added the bug label Apr 27, 2023
@krisfremen
Copy link
Member

krisfremen commented Apr 29, 2023

I believe this has to do with the format you are passing, will take a deeper look, but the following works correctly:

arrow.get('2020-01-01T02:03:01', tzinfo='Asia/Seoul')
<Arrow [2020-01-01T02:03:01+09:00]>

@krisfremen
Copy link
Member

That is actually some strange behavior, I will need to dig deeper to see what can be done.

@andrewelkins
Copy link
Contributor

andrewelkins commented Jul 19, 2023

Odd one for sure. Add year and it'll work.

end_time_as_cron = '2020 1 10 4 3 [*]' # linux cron expression
arrow.get(end_time_as_cron, 'YYYY m H D M [*]', tzinfo='Asia/Seoul')
<Arrow [2020-03-04T10:01:00+09:00]>

edit
The plot thickens. I can only reproduce with Asia/Seoul

>>> end_time_as_cron = '1 10 4 3' # linux cron expression
>>> arrow.get(end_time_as_cron, 'm H D M', tzinfo='America/Los_Angeles')
<Arrow [0001-03-04T10:01:00-08:00]>
>>> arrow.get(end_time_as_cron, 'm H D M', tzinfo='Asia/Seoul')
<Arrow [0001-03-04T10:01:00+08:27:52]>
>>> arrow.get(end_time_as_cron, 'm H D M', tzinfo='Europe/Vienna')
<Arrow [0001-03-04T10:01:00+01:00]>
>>>

Datetime.datetime has the same behavior

>>> datetime.datetime(
            1, 2, 2, 12, 30, 45, 999999, tzinfo=pytz.timezone("Asia/Seoul")
        )
datetime.datetime(1, 2, 2, 12, 30, 45, 999999, tzinfo=<DstTzInfo 'Asia/Seoul' LMT+8:28:00 STD>)

@andrewelkins
Copy link
Contributor

Found it. It's hinted in that datetime response. LMT which explains why using a more recent year "fixes" it. https://blog.qax.io/pytz-and-strange-timezones/
https://en.wikipedia.org/wiki/Local_mean_time

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

No branches or pull requests

3 participants