Duration

open 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
external val blank: Boolean
Link copied to clipboard
external val days: Int
Link copied to clipboard
external val hours: Int
Link copied to clipboard
external val microseconds: Int
Link copied to clipboard
external val milliseconds: Int
Link copied to clipboard
external val minutes: Int
Link copied to clipboard
external val months: Int
Link copied to clipboard
external val nanoseconds: Int
Link copied to clipboard
external val seconds: Int
Link copied to clipboard
external val sign: Int
Link copied to clipboard
external val weeks: Int
Link copied to clipboard
external val years: Int

Functions

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

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

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

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

open external fun toLocaleString(locales: ReadonlyArray<UnicodeBCP47LocaleIdentifier>, options: DateTimeFormatOptions = definedExternally): String
open external fun toLocaleString(locales: ReadonlyArray<Locale>, options: DateTimeFormatOptions = definedExternally): String
open external fun toLocaleString(locales: Locale, options: DateTimeFormatOptions = definedExternally): String
Link copied to clipboard
external fun toString(options: ToStringPrecisionOptions = definedExternally): String
Link copied to clipboard
external fun total(totalOf: JsAny): Int
Link copied to clipboard
operator external fun unaryMinus(): Duration
Link copied to clipboard
external fun with(durationLike: DurationLike): Duration