arrow-py / arrow

🏹 Better dates & times for Python
https://arrow.readthedocs.io
Apache License 2.0
8.64k stars 667 forks source link

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

Open pritisolanki opened 2 years ago

pritisolanki commented 2 years ago

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

krisfremen commented 2 years ago

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!