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] [, timeZone])
-
Return true if daylight savings time is active for the given date.
Note: If no timezone is provided, this will not use timezone rules, rather
a simplistic method of comparing offsets in January and June for the local
browser.If a timezone is provided, daylights savings will be determined at the
given date in that timezone.Please note: javascript dates will always have a local timezone
offset. The underlying milliseconds from epoch value will be used as the
source of truth for the time. This point in time will then be used to
determine whether daylight savings is active at that underlying millisecond
value in the given timezone (if provided).Parameters:
Name Type Argument Description dDate <optional>
the date to check. If omitted, the current date will be
checked.timeZonebaja.TimeZone <optional>
the timezone to use.
Returns:
true if daylight savings time is active
- Type
- boolean
-
<static> make(id [, utcOffset] [, dstOffset] [, startRule] [, endRule] [, params])
-
Make a new
baja:TimeZoneinstance.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 theTimeZoneDatabase.Parameters:
Name Type Argument Default Description idstring utcOffsetnumber <optional>
0 UTC offset in milliseconds
dstOffsetnumber <optional>
0 DST offset in milliseconds
startRulestring <optional>
null daylight savings start rule, encoded as a
string. This can be specific to the JVM.nullis an acceptable value.endRulestring <optional>
null daylight savings end rule - same caveats as
startRuleparamsObject <optional>
Properties
Name Type Argument Description displayNamestring <optional>
long display name, when DST is
inactivedstDisplayNamestring <optional>
long display name, when DST is
activeshortDisplayNamestring <optional>
short display name, when DST is
inactiveshortDstDisplayNamestring <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
decodeFromStringdirectly.Parameters:
Name Type Argument Description strstring batchbaja.comm.Batch <optional>
optional batch to use
- Inherited From:
Returns:
may return the Simple instance
directly, or a Promise resolving to same - so wrap inPromise.resolve()
if unsure.- Type
- baja.Simple | Promise.<baja.Simple>
-
decodeFromString(str)
-
Decode a
baja:TimeZoneinstance from the given string.Parameters:
Name Type Description strstring - Overrides:
Returns:
- Type
- baja.TimeZone
-
encodeToString()
-
Encode this
baja:TimeZoneinstance 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 isArray.<String> <optional>
An optional array of filters to add to the
agent query.batchbaja.comm.Batch <optional>
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 dstboolean <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 dstboolean <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
-
getTypeDisplayName( [cx])
-
Gets the friendly type display name for this object.
Parameters:
Name Type Argument Description cxObject <optional>
a context to be passed down to Type
- Since:
-
- Niagara 4.10
- Inherited From:
- See:
-
- baja.Type#getDisplayName
Returns:
If no context is provided, the type
display name is returned synchronously as a string. If context provided,
the type display name is resolved via a promise as a string.- Type
- Promise.<string> | string
-
getUtcOffset()
-
Get the UTC offset in milliseconds.
Returns:
- Type
- number
-
make()
-
- Overrides:
- See:
-
- .make
-
newCopy( [exact])
-
Every value may be cloned using the
newCopymethod.Please note that
Simples are immutable so they don't
allocate a new instance.Parameters:
Name Type Argument Description exactBoolean <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 cxObject <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). -
valueOf()
-
- Inherited From:
Returns:
the string encoding of the Simple, by default
- Type
- String