Time namespace. This namespace exports the JS-Joda library, but also provides additional functionality.
Methods
(static) toZDT(when) → {time.ZonedDateTime}
Converts the passed in when to a time.ZonedDateTime based on the following set of rules.
- null, undefined: time.ZonedDateTime.now()
- time.ZonedDateTime: unmodified
- Java ZonedDateTime, DateTimeType: converted to time.ZonedDateTime equivalent
- JavaScript native Date: converted to a
time.ZonedDateTime
using system timezone - number, bigint, Java Number, DecimalType: rounded and added to
time.ZonedDateTime.now()
as milliseconds Quantity
& QuantityType: if the unit is time-compatible, added totime.ZonedDateTime.now()
- Item: converts the state of the Item based on the *Type rules described here
- String, Java String, StringType: parsed based on the following rules; if no timezone is specified system timezone is used
- ISO 8601 DateTime: any Date, Time or DateTime with optional time offset and/or time zone in the ISO8601 calendar system
- ISO 8601 Duration: any Duration in the ISO8601 calendar system (e.g. 'PT5H4M3.210S'), also see JS-Joda : Duration
- RFC (output from a Java ZonedDateTime.toString()): parsed to time.ZonedDateTime
- HH:mm[:ss] (i.e. 24 hour time): that time with today's date (seconds are optional)
- KK:mm[:ss][ ][aa] (i.e. 12 hour time): that time with today's date (seconds and space between time and am/pm are optional)
Parameters:
Name | Type | Description |
---|---|---|
when |
* | any of the types discussed above |
Throws:
error if the type, format, or contents of when are not supported
Returns:
- Type
- time.ZonedDateTime