squiggle/packages/website/docs/Api/Duration.mdx

95 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

2022-06-05 20:59:45 +00:00
---
2022-06-11 00:35:48 +00:00
sidebar_position: 6
2022-06-05 20:59:45 +00:00
title: Duration
---
2022-06-13 04:19:28 +00:00
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} />
2022-06-05 20:59:45 +00:00
### toString
2022-06-11 15:57:02 +00:00
2022-06-06 05:16:29 +00:00
```
toString: (duration) => string
2022-06-05 20:59:45 +00:00
```
## Units
2022-06-06 05:16:29 +00:00
### minutes
2022-06-11 15:57:02 +00:00
2022-06-06 05:16:29 +00:00
```
minutes: (number) => duration
2022-06-05 20:59:45 +00:00
```
2022-06-06 05:16:29 +00:00
### hours
2022-06-11 15:57:02 +00:00
2022-06-06 05:16:29 +00:00
```
hours: (number) => duration
2022-06-05 20:59:45 +00:00
```
2022-06-06 05:16:29 +00:00
### days
2022-06-11 15:57:02 +00:00
2022-06-06 05:16:29 +00:00
```
days: (number) => duration
2022-06-05 20:59:45 +00:00
```
2022-06-06 05:16:29 +00:00
### years
2022-06-11 15:57:02 +00:00
2022-06-06 05:16:29 +00:00
```
years: (number) => duration
2022-06-05 20:59:45 +00:00
```
2022-06-06 05:16:29 +00:00
### toHours
2022-06-11 15:57:02 +00:00
2022-06-06 05:16:29 +00:00
```
2022-06-11 00:35:48 +00:00
toHours: (duration) => number
2022-06-05 20:59:45 +00:00
```
2022-06-06 05:16:29 +00:00
### toMinutes
2022-06-11 15:57:02 +00:00
2022-06-06 05:16:29 +00:00
```
2022-06-11 00:35:48 +00:00
toMinutes: (duration) => number
2022-06-05 20:59:45 +00:00
```
2022-06-06 05:16:29 +00:00
### toDays
2022-06-11 15:57:02 +00:00
2022-06-06 05:16:29 +00:00
```
2022-06-11 00:35:48 +00:00
toDays: (duration) => number
2022-06-05 20:59:45 +00:00
```
2022-06-06 05:16:29 +00:00
### toYears
2022-06-11 15:57:02 +00:00
2022-06-06 05:16:29 +00:00
```
2022-06-11 00:35:48 +00:00
toYears: (duration) => number
2022-06-05 20:59:45 +00:00
```
## Algebra
2022-06-06 05:16:29 +00:00
### add
2022-06-11 15:57:02 +00:00
2022-06-06 05:16:29 +00:00
```
add: (duration, duration) => duration
2022-06-05 20:59:45 +00:00
```
2022-06-06 05:16:29 +00:00
### subtract
2022-06-11 15:57:02 +00:00
2022-06-06 05:16:29 +00:00
```
subtract: (duration, duration) => duration
2022-06-05 20:59:45 +00:00
```
2022-06-06 05:16:29 +00:00
### multiply
2022-06-11 15:57:02 +00:00
2022-06-06 05:16:29 +00:00
```
2022-06-11 00:35:48 +00:00
multiply: (duration, number) => duration
2022-06-05 20:59:45 +00:00
```
2022-06-06 05:16:29 +00:00
### divide
2022-06-11 15:57:02 +00:00
2022-06-06 05:16:29 +00:00
```
2022-06-11 00:35:48 +00:00
divide: (duration, number) => duration
2022-06-11 15:57:02 +00:00
```