Timezone#

quart_babel.get_timezone() BaseTzInfo | None#

Returns the timezone that should be used for this request as a pytz.timezone object. This returns None if used outside a request.

quart_babel.to_user_timezone(dt: datetime) datetime#

Convert a datetime object to the user’s timezone. This automatically happens on all date formatting unless rebasing is disabled. If you need to convert a datetime.datetime object at any time to the user’s timezone (as returned by get_timezone()) this function can be used.

quart_babel.to_utc(dt: datetime) datetime#

Convert a datetime object to the user’s timezone. This automatically happens on all date formatting unless rebasing is disabled. If you need to convert a datetime.datetime object at any time to the user’s timezone (as returned by get_timezone()) this function can be used.