Duration

class Duration(    val years: Int = definedExternally,     val months: Int = definedExternally,     val weeks: Int = definedExternally,     val days: Int = definedExternally,     val hours: Int = definedExternally,     val minutes: Int = definedExternally,     val seconds: Int = definedExternally,     val milliseconds: Int = definedExternally,     val microseconds: Int = definedExternally,     val nanoseconds: Int = definedExternally) : HasDurationOperations<Duration, DurationArithmeticOptions> , Localizable<DateTimeFormatOptions> (source)

A Temporal.Duration represents an immutable duration of time which can be used in date/time arithmetic.

See https://tc39.es/proposal-temporal/docs/duration.html for more details.

Constructors

Link copied to clipboard
constructor(    years: Int = definedExternally,     months: Int = definedExternally,     weeks: Int = definedExternally,     days: Int = definedExternally,     hours: Int = definedExternally,     minutes: Int = definedExternally,     seconds: Int = definedExternally,     milliseconds: Int = definedExternally,     microseconds: Int = definedExternally,     nanoseconds: Int = definedExternally)

Types

Link copied to clipboard

Properties

Link copied to clipboard
Link copied to clipboard
val days: Int
Link copied to clipboard
val hours: Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val months: Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val sign: Int
Link copied to clipboard
val weeks: Int
Link copied to clipboard
val years: Int

Functions

Link copied to clipboard
fun abs(): Duration
Link copied to clipboard
open fun add(duration: Duration, options: DurationArithmeticOptions = definedExternally): Duration
open fun add(duration: DurationLike, options: DurationArithmeticOptions = definedExternally): Duration
open fun add(duration: String, options: DurationArithmeticOptions = definedExternally): Duration
Link copied to clipboard
Link copied to clipboard
fun round(roundTo: JsAny): Duration
Link copied to clipboard
open fun subtract(duration: Duration, options: DurationArithmeticOptions = definedExternally): Duration
open fun subtract(duration: DurationLike, options: DurationArithmeticOptions = definedExternally): Duration
open fun subtract(duration: String, options: DurationArithmeticOptions = definedExternally): Duration
Link copied to clipboard
fun toJSON(): String
Link copied to clipboard

Returns a value as a string value appropriate to the host environment's current locale.

open fun toLocaleString(locales: ReadonlyArray<UnicodeBCP47LocaleIdentifier>, options: DateTimeFormatOptions = definedExternally): String
open fun toLocaleString(locales: ReadonlyArray<Locale>, options: DateTimeFormatOptions = definedExternally): String
open fun toLocaleString(locales: Locale, options: DateTimeFormatOptions = definedExternally): String

open fun toLocaleString(locales: UnicodeBCP47LocaleIdentifier, options: DateTimeFormatOptions = definedExternally): String

Converts a value to a string by using the current or specified locale.

Link copied to clipboard
fun toString(options: ToStringPrecisionOptions = definedExternally): String
Link copied to clipboard
fun total(totalOf: JsAny): Int
Link copied to clipboard
operator fun unaryMinus(): Duration
Link copied to clipboard
fun with(durationLike: DurationLike): Duration