I am trying to get the client timezone information string. For example: America/New_York,Africa/Cairo..etc Now I can only get client_timezone_offset. I convert it to datetime first, and tried to get timezone information. But I can only get the string like "UTC+08:00". Is there any way that I can get timezone string like "America/New_York" ?
This is my sample code, I can only get the string like "UTC+08:00"
dt = datetime.fromtimestamp(
float(time.time()),
timezone(timedelta(seconds=self.current_request.client_timezone_offset)),
)
tz = timezone(timedelta(seconds=self.current_request.client_timezone_offset))
timezone_string = (
"America/New_York" if tz.tzname(dt) is None else str(tz.tzname(dt))
)