Home Reference Source Repository
import {ZoneId} from 'js-joda/src/ZoneId.js'
public class | source

ZoneId

Method Summary

Public Methods
public

equals(other: *): boolean

Checks if this time-zone ID is equal to another time-zone ID.

public

A hash code for this time-zone ID.

public

Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.

public

Gets the time-zone rules for this ID allowing calculations to be performed.

public

Outputs this zone as a {@code String}, using the ID.

Public Methods

public equals(other: *): boolean source

Checks if this time-zone ID is equal to another time-zone ID.

The comparison is based on the ID.

Params:

NameTypeAttributeDescription
other *

the object to check, null returns false

Return:

boolean

true if this is equal to the other time-zone ID

public hashCode(): number source

A hash code for this time-zone ID.

Return:

number

a suitable hash code

public normalized(): ZoneId source

Normalizes the time-zone ID, returning a {@code ZoneOffset} where possible.

The returns a normalized {@code ZoneId} that can be used in place of this ID. The result will have {@code ZoneRules} equivalent to those returned by this object, however the ID returned by {@code getId()} may be different.

The normalization checks if the rules of this {@code ZoneId} have a fixed offset. If they do, then the {@code ZoneOffset} equal to that offset is returned. Otherwise {@code this} is returned.

Return:

ZoneId

the time-zone unique ID, not null

public rules(): ZoneRules source

Gets the time-zone rules for this ID allowing calculations to be performed.

The rules provide the functionality associated with a time-zone, such as finding the offset for a given instant or local date-time.

A time-zone can be invalid if it is deserialized in a Java Runtime which does not have the same rules loaded as the Java Runtime that stored it. In this case, calling this method will throw a {@code ZoneRulesException}.

The rules are supplied by ZoneRulesProvider. An advanced provider may support dynamic updates to the rules without restarting the Java Runtime. If so, then the result of this method may change over time. Each individual call will be still remain thread-safe.

ZoneOffset will always return a set of rules where the offset never changes.

Return:

ZoneRules (nullable: false)

the rules, not null

Throw:

*

ZoneRulesException if no rules are available for this ID

public toString(): string source

Outputs this zone as a {@code String}, using the ID.

Return:

string

a string representation of this time-zone ID, not null