95 lines
1.1 KiB
Plaintext
95 lines
1.1 KiB
Plaintext
---
|
|
sidebar_position: 6
|
|
title: Duration
|
|
---
|
|
|
|
Duration works with the [Date](/docs/Api/Date) type. Similar to the Date implementation, the Duration functions are early and experimental. There is no support yet for date or duration probability distributions.
|
|
|
|
Durations are stored in Unix milliseconds.
|
|
|
|
import TOCInline from "@theme/TOCInline";
|
|
|
|
<TOCInline toc={toc} />
|
|
|
|
### toString
|
|
|
|
```
|
|
toString: (duration) => string
|
|
```
|
|
|
|
## Units
|
|
|
|
### minutes
|
|
|
|
```
|
|
minutes: (number) => duration
|
|
```
|
|
|
|
### hours
|
|
|
|
```
|
|
hours: (number) => duration
|
|
```
|
|
|
|
### days
|
|
|
|
```
|
|
days: (number) => duration
|
|
```
|
|
|
|
### years
|
|
|
|
```
|
|
years: (number) => duration
|
|
```
|
|
|
|
### toHours
|
|
|
|
```
|
|
toHours: (duration) => number
|
|
```
|
|
|
|
### toMinutes
|
|
|
|
```
|
|
toMinutes: (duration) => number
|
|
```
|
|
|
|
### toDays
|
|
|
|
```
|
|
toDays: (duration) => number
|
|
```
|
|
|
|
### toYears
|
|
|
|
```
|
|
toYears: (duration) => number
|
|
```
|
|
|
|
## Algebra
|
|
|
|
### add
|
|
|
|
```
|
|
add: (duration, duration) => duration
|
|
```
|
|
|
|
### subtract
|
|
|
|
```
|
|
subtract: (duration, duration) => duration
|
|
```
|
|
|
|
### multiply
|
|
|
|
```
|
|
multiply: (duration, number) => duration
|
|
```
|
|
|
|
### divide
|
|
|
|
```
|
|
divide: (duration, number) => duration
|
|
```
|