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

Missing timezone string for utc+5:30 TZ #1108

Open
pritisolanki opened this issue May 22, 2022 · 1 comment
Open

Missing timezone string for utc+5:30 TZ #1108

pritisolanki opened this issue May 22, 2022 · 1 comment
Labels

Comments

@pritisolanki
Copy link

Date format missing timezone string

Issue Description

flight_schedule_date = arrow.now("America/New_York")
flight_landing_date = flight_schedule_date.shift(hours=28).to('+05:30')

print(f'flight scheduled departure is {flight_schedule_date.format("DD,MMM HH:mm A ZZZ")} and expected arrival at destination is {flight_landing_date.format("DD,MMM HH:mm A ZZZ")}')

Output
flight scheduled departure is 22,May 10:40 AM EDT and expected arrival at destination is 24,May 00:10 AM
which is missing "IST" at end

But when I add ZZ, I get correct tz expression
flight scheduled departure is 22,May 10:39 AM EDT and expected arrival at destination is 24,May 00:09 AM +05:30

System Info

  • 🖥 OS name and version: macOS 10.15.7
  • 🐍 Python version: 3.8.2
  • 🏹 Arrow version: 1.2.2
@krisfremen
Copy link
Member

hey @pritisolanki,

In order for ZZZ to be used, the timezone expression must be the time zone name, and not the numeric values("+05:30") as they are ambiguous and can match back to multiple named time zones.

Example:

>>> flight_schedule_date = arrow.now("America/New_York")
>>> flight_landing_date = flight_schedule_date.shift(hours=28).to('Asia/Kolkata')
>>> flight_landing_date.format("DD,MMM HH:mm A ZZZ")
'23,Jun 10:05 AM IST'

Cheers!

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

2 participants