squiggle/packages/website/docs/Api/Date.md

43 lines
477 B
Markdown
Raw Normal View History

2022-06-11 00:35:48 +00:00
---
sidebar_position: 1
title: Date
---
### makeFromYear
```
Date.makeFromYear: (number) => date
```
```js
makeFromYear(2022.32);
```
### toString
```
toString: (date) => string
```
### subtract
```
subtract: (date, date) => duration
subtract: (date, duration) => date
```
```js
2022-06-11 15:57:02 +00:00
makeFromYear(2040) - makeFromYear(2020); // 20 years
makeFromYear(2040) - years(20); // 2020
2022-06-11 00:35:48 +00:00
```
### add
```
add: (date, duration) => date
```
```js
makeFromYear(2022.32) + years(5);
```