apps-script-utils 2.1.1 Help

TimeUnit

type TimeUnit = "millisecond" | "second" | "minute" | "hour" | "day" | "month" | "year";

"millisecond", "second", "minute" and "hour" are fixed multiples of a millisecond. "day", "month" and "year" are calendar units with no fixed length: a day is 23 or 25 hours across a daylight-saving change, and a month is anything from 28 to 31 days.

Which of the two a function applies is stated on its own page — diff counts whole calendar units, offset moves by them and clamps the day of the month where it has to.

Examples

Shape

diff(a, b, "day"); offset(date, 1, "month");

See also

Source

src/time/types/TimeUnit.ts

23 September 2026

This documentation was generated with AI (Claude) from the library's source code.