Skip to content

Calendar

Performs calendar-aware date arithmetic in workflow scripts.

Remarks

A calendar instance resolves its schedule lazily and caches it for the lifetime of the script. If no schedule is configured, the proxy uses an empty schedule. Date inputs must be convertible to DateTimeOffset; invalid values and invalid duration or time-zone strings raise script errors.

Capabilities

Presets

Calendar Queries

  • Calendar.Today: Returns the current date and time in UTC time.
  • Calendar.GetDateTime: Returns the next valid date and time, according to calendar rules, after adding the given duration to the specified date.
  • Calendar.GetHoursInDay: Returns the total number of hours in the specified date.
  • Calendar.GetToday: Returns the current date and time in the specified time zone.

Date Arithmetic

  • Calendar.Add: Adds a specified number of hours to a DateTimeOffset value and returns the result.
  • Calendar.AddDays: Adds a specified number of days to a DateTimeOffset value and returns the next valid date and time according to the calendar rules.
  • Calendar.AddMonth: Adds calendar months and adjusts the result to the next time included by this calendar.
  • Calendar.AddMonths: Adds a specified number of months to a DateTimeOffset value and returns the result.
  • Calendar.AddTimeSpan: Returns a new DateTimeOffset by adding a specified duration, considering calendar rules.
  • Calendar.AddYear: Adds calendar years and adjusts the result to the next time included by this calendar.
  • Calendar.AddYears: Adds a specified number of years to a DateTimeOffset value and returns the result.
  • Calendar.Subtract: Subtracts one date-time value from another and returns the difference in hours.

Async Date Arithmetic

Time Zones

Async Time Zones

Async Calendar Queries

Creation and Presets