time

time

Source:

Time namespace. This namespace exports the JS-Joda library, but also provides additional functionality.

Methods

(static) toZDT(when)

Source:

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 equivalnet
  • JavaScript native Date: converted to a time.ZonedDateTime using SYSTEM as the timezone
  • number, bigint, Java Number, DecimalType: rounded and added to time.ZonedDateTime.now() as milliseconds
  • QuantityType: if the units are Time, added to 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
    • ISO 8601: Not yet implemented
    • 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)
    • Duration: any duration string supported by time.Duration (e.g. 'PT5H4M3.210S'), see https://js-joda.github.io/js-joda/class/packages/core/src/Duration.js~Duration.html#static-method-parse
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:

time.ZonedDateTime