arrow icon indicating copy to clipboard operation
arrow copied to clipboard

Missing timezone string for utc+5:30 TZ

Open pritisolanki opened this issue 2 years ago • 1 comments

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

pritisolanki avatar May 22 '22 14:05 pritisolanki

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!

krisfremen avatar Jun 22 '22 00:06 krisfremen