Shifts a date or datetime by the specified amount and unit.
Returns the same type as the input: Date in → Date out,
NaiveDateTime in → NaiveDateTime out, DateTime in → DateTime out.
When adding sub-day units (hours, minutes, seconds, milliseconds)
to a Date, the result is promoted to a NaiveDateTime since a Date
cannot represent time-of-day.
For months and years, end-of-month clamping is applied: e.g.,
Jan 31 + 1 month = Feb 28 (or Feb 29 in a leap year).
Examples
dateadd(date(2024, 1, 15), 10, 'days') → ~D[2024-01-25]
dateadd(date(2024, 1, 31), 1, 'months') → ~D[2024-02-29]
dateadd(date(2024, 1, 15), 3, 'hours') → ~N[2024-01-15 03:00:00]