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 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:

time.ZonedDateTime

Type Definitions

ZonedDateTime

Source:
Type:
  • module:@js-joda/core~ZonedDateTime

ZonedDateTime

Source:
Type:
  • module:@js-joda/core~ZonedDateTime

ZonedDateTime

Source:
Type:
  • module:@js-joda/core~ZonedDateTime