ILibTimeZone class
A time zone and its UTC offset / daylight-saving rules.
Create one from an IANA zone id (e.g. 'America/New_York'), the special id
'local' for the system zone, a fixed offset, or a locale. Once created it
answers offset and DST queries for a given ILibDate.
Constructors
-
ILibTimeZone(String id, [Map<
String, dynamic> ? allZoneData]) -
Create a zone for the IANA
id(e.g.'Europe/Paris'), or the special id'local'for the system zone. Unknown ids fall back to'Etc/UTC'. -
ILibTimeZone.defaultZone([Map<
String, dynamic> ? allZoneData]) - Create the zone that the current locale commonly uses.
-
ILibTimeZone.fromLocale(String locale, [Map<
String, dynamic> ? allZoneData]) -
Create the zone that
localecommonly uses. - ILibTimeZone.fromOffset(int offsetMinutes)
-
Create a fixed-offset zone
offsetMinuteseast of UTC, with no DST. The id is derived as an RFC 822 style string (e.g.'UTC+0530').
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getCountry(
) → String -
The ISO 3166-1 alpha-2 country code this zone belongs to, or
''. -
getDisplayName(
ILibDate date, [String style = '']) → String -
A human-readable name for this zone at
date. -
getDSTSavings(
) → Map< String, int> -
The daylight-saving amount as a
{'h': ..., 'm': ...}map, or zero when this zone does not observe DST. -
getDSTSavingsMinutes(
) → double - The daylight-saving amount in minutes, or zero when this zone does not observe DST.
-
getDSTSavingsStr(
) → String -
The daylight-saving amount as a string, or
'0:0'when this zone does not observe DST. -
getId(
) → String -
The id of this zone (e.g.
'America/New_York','local','Etc/UTC'). -
getOffset(
ILibDate date) → Map< String, int> -
The total offset from UTC for
date(standard + DST when in effect) as a{'h': ..., 'm': ...}map. -
getOffsetMillis(
ILibDate date) → int -
The total offset from UTC for
datein milliseconds. -
getOffsetMinutes(
ILibDate date, {bool wallTime = false}) → double -
The total offset from UTC for
datein minutes east of UTC (standard + DST when in effect). -
getOffsetStr(
ILibDate date) → String -
The total offset from UTC for
dateas a string (e.g.'-4:0'). -
getRawOffset(
) → Map< String, int> -
The standard (non-DST) offset from UTC as a
{'h': ..., 'm': ...}map. -
getRawOffsetMillis(
) → int - The standard (non-DST) offset from UTC in milliseconds.
-
getRawOffsetMinutes(
) → double - The standard (non-DST) offset from UTC in minutes east of UTC.
-
getRawOffsetStr(
) → String -
The standard (non-DST) offset from UTC as a string (e.g.
'-5:0'). -
inDaylightTime(
ILibDate date, {bool wallTime = false}) → bool -
Whether daylight-saving time is in effect for
datein this zone. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
useDaylightTime(
) → bool - Whether this zone observes daylight-saving time.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- sampleYear ↔ int Function()
-
The year whose Jan/Jun offsets are sampled to classify standard vs daylight.
getter/setter pair
- sysOffsetMinutesForInstant ↔ double Function(int instantMs)
-
System time-zone offset (minutes east of UTC) at a given Unix-millis instant.
getter/setter pair
- sysWallOffsetMinutes ↔ double Function(int year, int month, int day, int hour, int minute)
-
System time-zone offset (minutes east of UTC) for a wall-clock date/time, via core
DateTime(honours theTZenv, and forward-normalizes a non-existent spring-forward wall time). Overridable so tests can pin a zone hermetically.getter/setter pair
Static Methods
-
getAvailableIds(
[String? country]) → List< String> -
All known zone ids, or just those used in
country(an ISO 3166-1 alpha-2 code) when given. Includes'local'whencountryis null.