def build_names(zone):
	names = []
	tzicu = TimeZone.createTimeZone(zone)
	names.append(tzicu.getDisplayName(False, 1))
	names.append(tzicu.getDisplayName(False, 2))

	if tzicu.useDaylightTime():
		names.append(tzicu.getDisplayName(True, 1))
		names.append(tzicu.getDisplayName(True, 2))
	return names
Ejemplo n.º 2
0
def get_timezone():
    """Returns the timezone that should be used for this request as
    `an icu.TimeZone` object.  Returns `None` if used outside of
    a request.
    """
    ctx = _request_ctx_stack.top
    tzinfo = getattr(ctx, 'icu_tzinfo', None)
    if tzinfo is None:
        icu = ctx.app.extensions['icu']
        if icu.timezone_selector_func is None:
            tzinfo = icu.default_timezone
        else:
            rv = icu.timezone_selector_func()
            if rv is None:
                tzinfo = icu.default_timezone
            else:
                if isinstance(rv, string_types):
                    tzinfo = TimeZone.createTimeZone(rv)
                else:
                    tzinfo = rv
        ctx.icu_tzinfo = tzinfo
    return tzinfo
def build_std_offset(zone):
	tzicu = TimeZone.createTimeZone(zone)
	return tzicu.getRawOffset() / 1000 / 60