Class: TimeZone

baja. TimeZone


new TimeZone()

Represents a baja:TimeZone in BajaScript.

Extends

Members


<static> DEFAULT :baja.TimeZone

Type:

<static> GMT :baja.TimeZone

Type:

<static> NULL :baja.TimeZone

Type:

<static> UTC :baja.TimeZone

Type:

Methods


<static> isDstActive( [d])

Return true if daylight savings time is active for the given date.

Parameters:
Name Type Argument Description
d Date <optional>

the date to check. If omitted, the current date will be
checked.

Returns:

true if daylight savings time is active

Type
boolean

<static> make(id [, utcOffset] [, dstOffset] [, startRule] [, endRule] [, params])

Make a new baja:TimeZone instance.

There is not usually a reason, nor a good way, to create time zones
directly in BajaScript: you will most likely want to use the time zones
returned from the station, using the TimeZoneDatabase.

Parameters:
Name Type Argument Default Description
id string
utcOffset number <optional>
0

UTC offset in milliseconds

dstOffset number <optional>
0

DST offset in milliseconds

startRule string <optional>
null

daylight savings start rule, encoded as a
string. This can be specific to the JVM. null is an acceptable value.

endRule string <optional>
null

daylight savings end rule - same caveats as
startRule

params Object <optional>
Properties
Name Type Argument Description
displayName string <optional>

long display name, when DST is
inactive

dstDisplayName string <optional>

long display name, when DST is
active

shortDisplayName string <optional>

short display name, when DST is
inactive

shortDstDisplayName string <optional>

short display name, when DST
is active


decodeAsync(str [, batch])

The string encoding of certain Simples may include Type information, or
other data that may be require asynchronous operations to decode. BOX is
designed to handle these situations when decoding data from the station,
but when user code needs to decode string-encoded Simples directly, prefer
this method as it gives the individual Simple a chance to import Types,
etc. to ensure that the decoded Simple is fully correct.

The default implementation just returns decodeFromString directly.

Parameters:
Name Type Argument Description
str string
batch baja.comm.Batch <optional>

optional batch to use

Inherited From:
Returns:

may return the Simple instance
directly, or a Promise resolving to same - so wrap in Promise.resolve()
if unsure.

Type
baja.Simple | Promise.<baja.Simple>

decodeFromString(str)

Decode a baja:TimeZone instance from the given string.

Parameters:
Name Type Description
str string
Overrides:
Returns:
Type
baja.TimeZone

encodeToString()

Encode this baja:TimeZone instance to a string.

Overrides:
Returns:
Type
string

equals(obj)

Equality test.

Parameters:
Name Type Description
obj
Inherited From:
Returns:
Type
Boolean

equivalent(obj)

Equivalence test.

equivalent() is used to compare if two Objects have equivalent
state, but might not want to return true for equals since it
it has implied semantics for many operations. The default
implementation returns the result of baja.Object#equals.

Parameters:
Name Type Description
obj
Inherited From:
Returns:
Type
Boolean

getAgents( [is], batch)

Returns a promise that resolves to the agent list for this Object.

Parameters:
Name Type Argument Description
is Array.<String> <optional>

An optional array of filters to add to the
agent query.

batch baja.comm.Batch

An optional object used to batch network
calls together.

Inherited From:
See:
Returns:

A promise that will resolve with the Agent Info.

Type
Promise

getDaylightAdjustment()

Return the DST adjustment, in milliseconds.

Returns:
Type
number

getDisplayName( [dst])

Get the display name for this time zone.

Parameters:
Name Type Argument Description
dst boolean <optional>

whether DST should be considered active when getting
the display name. If omitted, the method will consider whether DST is
active at the present moment.

Returns:
Type
string

getIcon()

Return the Object's Icon.

Inherited From:
Returns:
Type
baja.Icon

getId()

Get the time zone ID.

Returns:
Type
string

getShortDisplayName( [dst])

Get the short display name for this time zone.

Parameters:
Name Type Argument Description
dst boolean <optional>

whether DST should be considered active when getting
the short display name. If omitted, the method will consider whether DST is
active at the present moment.

Returns:
Type
string

getType()

Get the type of this instance.

Inherited From:
Returns:
Type
Type

getUtcOffset()

Get the UTC offset in milliseconds.

Returns:
Type
number

make()

Overrides:
See:
  • .make

newCopy( [exact])

Every value may be cloned using the newCopy method.

Please note that Simples are immutable so they don't
allocate a new instance.

Parameters:
Name Type Argument Description
exact Boolean <optional>

true if an exact copy of the value should be
made (only valid in the Component architecture).

Inherited From:
See:
Returns:

a copy of the value (or the same instance if the value is a
Simple).


toString( [cx])

Returns the String representation of this object.

Parameters:
Name Type Argument Description
cx Object <optional>

optional context information to be used when
formatting the string

Inherited From:
Overrides:
See:
Returns:

a string (if no context passed), or
either a string or a Promise (if context passed).

Type
String | Promise.<String>

valueOf()

Return the inner value of the object.

By default the object's instance is returned.

Inherited From:
Returns:

the inner value of the object or just the object's instance.

Type
*