squiggle/packages/website/docs/Api/Date.md
2022-06-12 21:19:28 -07:00

797 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.

makeFromYear

(Now makeDateFromYear)

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

toString

toString: (date) => string

add

add: (date, duration) => date
makeFromYear(2022.32) + years(5);

subtract

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