Date Math
Adds or subtracts calendar, elapsed, or business time from a date or datetime.
@lainstack/time/date-math · Data
How to use it
Section titled “How to use it”Use this block to add or subtract an amount of time from a date or a date and time. For the current moment, use @lainstack/time/current first. To pause the run until a time, use @lainstack/time/wait. To compare two dates, use @lainstack/flow/condition with the date type.
inputKinddatetakes a value like2026-03-31. Seconds, minutes and hours needdatetime. With a date input,time,localIso,isoandepochMsare null.amountis a whole number from 0 to 1,000,000. To go back in time setoperationtosubtract. Do not use a negative amount.monthsandyearskeep the day if they can and otherwise use the last day of the month. 31 January plus 1 month is the last day of February.- On a date and time,
days,weeks,monthsandyearskeep the local clock time.hours,minutesandsecondsadd exact elapsed time. - A date and time without an offset is read in
timezone(defaultUTC). A local time that does not exist (clocks moved forward) fails. A time that exists twice usesdisambiguation,earlierby default. business_daysskipsweekendDays(default Saturday and Sunday) and the listedholidays(up to 64 dates,YYYY-MM-DD). Both lists are fixed in the block. The limit is 10,000 business days. Zero business days returns the same date, even on a weekend.- An invalid date, an unknown timezone or a result outside years 0001 to 9999 fails the step.
Settings
Section titled “Settings”| Setting | Key | Type | Details |
|---|---|---|---|
| Input type (required) | inputKind |
One of Date, Date and time |
Default date. |
| Value (required) | value |
Date | A literal or one whole-value reference. |
| Operation (required) | operation |
One of Add, Subtract |
Default add. |
| Amount (required) | amount |
Number | |
| Unit (required) | unit |
One of Seconds, Minutes, Hours, Days, Weeks, Months, Years, Business days |
Default days. |
| Timezone (required) | timezone |
Text | IANA timezone used to resolve and format the result. |
| Repeated local time | disambiguation |
One of Earlier, Later |
Choose which instant to use when clocks move back. Default earlier. |
| Weekend days | weekendDays |
List | Days excluded by Business days arithmetic. At most 6 items. |
| Holidays | holidays |
List | Specific YYYY-MM-DD dates excluded by Business days arithmetic. At most 64 items. |
Outputs
Section titled “Outputs”| Output | Path | Type |
|---|---|---|
| Input kind | kind |
Text |
| Result | result |
Text |
| Resolved timezone | resolvedTimezone |
Text |
| Date | date |
Date |
| Time | time |
Text |
| Local ISO | localIso |
Text |
| UTC ISO | iso |
Text |
| Epoch milliseconds | epochMs |
Number |