squiggle/packages/website/docs/Api/Date.md
2022-07-19 16:18:28 -07:00

767 B

sidebar_position title
1 Date

Squiggle date types are a very simple implementation on Javascript's Date type. It's mainly here for early experimentation. There are more relevant functions for the Duration type.

fromYear

Date.fromYear: (number) => date
Date.fromYear(2022.32);

toString

toString: (date) => string

add

add: (date, duration) => date
Date.fromYear(2022.32) + years(5);

subtract

subtract: (date, date) => duration
subtract: (date, duration) => date
Date.fromYear(2040) - Date.fromYear(2020); // 20 years
Date.fromYear(2040) - years(20); // 2020