Add to date

Description

The add-to-date function takes a date and a number as input and returns a new date after adding the specified unit of time to the original date.

Parameters

  • date: a string representing a date.
  • number: a number representing the amount of time to add to the date.
  • inputLocale: (optional) a string representing the locale of the input date. Accepted values are "pt", "nl", "en", "de", "ja", "zh", "fr". If not provided, the default value is "en".
  • unit: (optional) a string representing the unit of time to add to the date. Accepted values are "days", "hours", "months", "years", "minutes", "seconds", "milliseconds". If not provided, the default value is "seconds".

Examples

add-to-date("2022-12-25", 3, unit="days")
# Returns: "2022-12-28"

add-to-date("2022-12-25", 3, inputLocale="fr", unit="hours")
# Returns: "2022-12-25 03:00:00"

add-to-date("2022-12-25", 3, inputLocale="pt", unit="years")
# Returns: "2025-12-25"