time

Namespace

time

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

Source:

Methods

(static) javaInstantToJsInstant(instant) → {time.Instant}

Description:
  • Convert Java Instant to JS-Joda Instant.

Source:
Parameters:
Name Type Description
instant JavaInstant

java.time.Instant

Returns:
Type
time.Instant

(static) javaZDTToJsZDT(zdt) → {time.ZonedDateTime}

Description:
  • Convert Java ZonedDateTime to JS-Joda ZonedDateTime.

Source:
Parameters:
Name Type Description
zdt JavaZonedDateTime

java.time.ZonedDateTime

Returns:
Type
time.ZonedDateTime

(static) toZDT(whenopt) → {time.ZonedDateTime}

Description:
  • 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 configured timezone
    • number, bigint, Java Number, DecimalType: rounded and added to time.ZonedDateTime.now() as milliseconds
    • Quantity & QuantityType: if the unit is time-compatible, added to time.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 the configured 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)
Source:
Parameters:
Name Type Attributes Description
when * <optional>

any of the types discussed above

Throws:

error if the type, format, or contents of when are not supported

Returns:
Type
time.ZonedDateTime