ZoneRules
Direct Subclass:
Static Method Summary
Static Public Methods | ||
public static |
of(offset: ZoneOffset): ZoneRules Obtains an instance of {@code ZoneRules} that always uses the same offset. |
Method Summary
Public Methods | ||
public |
Checks of the zone rules are fixed, such that the offset never varies. |
|
public |
isValidOffset(localDateTime: LocalDateTime, offset: ZoneOffset): boolean Checks if the offset date-time is valid for these rules. |
|
public |
offset(instantOrLocalDateTime: *): ZoneOffset |
|
public |
offsetOfInstant(instant: Instant): ZoneOffset Gets the offset applicable at the specified instant in these rules. |
|
public |
offsetOfLocalDateTime(localDateTime: LocalDateTime): ZoneOffset Gets a suitable offset for the specified local date-time in these rules. |
Static Public Methods
public static of(offset: ZoneOffset): ZoneRules source
Obtains an instance of {@code ZoneRules} that always uses the same offset.
The returned rules always have the same offset.
Params:
Name | Type | Attribute | Description |
offset | ZoneOffset | the offset, not null |
Public Methods
public isFixedOffset(): boolean source
Checks of the zone rules are fixed, such that the offset never varies.
public isValidOffset(localDateTime: LocalDateTime, offset: ZoneOffset): boolean source
Checks if the offset date-time is valid for these rules.
To be valid, the local date-time must not be in a gap and the offset must match the valid offsets.
Params:
Name | Type | Attribute | Description |
localDateTime | LocalDateTime | the date-time to check, not null, but null may be ignored if the rules have a single offset for all instants |
|
offset | ZoneOffset | the offset to check, null returns false |
public offset(instantOrLocalDateTime: *): ZoneOffset source
Params:
Name | Type | Attribute | Description |
instantOrLocalDateTime | * |
public offsetOfInstant(instant: Instant): ZoneOffset source
Gets the offset applicable at the specified instant in these rules.
The mapping from an instant to an offset is simple, there is only one valid offset for each instant. This method returns that offset.
Params:
Name | Type | Attribute | Description |
instant | Instant | the instant to find the offset for, not null, but null may be ignored if the rules have a single offset for all instants |
public offsetOfLocalDateTime(localDateTime: LocalDateTime): ZoneOffset source
Gets a suitable offset for the specified local date-time in these rules.
The mapping from a local date-time to an offset is not straightforward. There are three cases:
Thus, for any given local date-time there can be zero, one or two valid offsets. This method returns the single offset in the Normal case, and in the Gap or Overlap case it returns the offset before the transition.
Since, in the case of Gap and Overlap, the offset returned is a "best" value, rather than the "correct" value, it should be treated with care. Applications that care about the correct offset should use a combination of this method, {@link #getValidOffsets(LocalDateTime)} and {@link #getTransition(LocalDateTime)}.
Params:
Name | Type | Attribute | Description |
localDateTime | LocalDateTime | the local date-time to query, not null, but null may be ignored if the rules have a single offset for all instants |