Skip to content

GetDateTimeAsync

Returns the next valid date and time, according to calendar rules, after adding a given duration.

1
myCalendar.GetDateTimeAsync(relativeDate: string, offset?: ( Date | [DateTimeOffset](./../DateTimeOffset/index.md) )):Promise<DateTimeOffset>

Parameters

string relativeDate
    The duration string to add.

( Date | DateTimeOffset ) offset optional
    Specifies the offset value for the relative date and time. Optional; if not specified, the current date and time are used.

Returns

A Promise that resolves to a DateTimeOffset representing the next valid date and time by calendar rules.

Remarks

Example

1
2
var nextDate = await $Calendar.GetDateTimeAsync('PT2H', DateTimeOffset.parse('2023-02-08T17:00'));
// nextDate will be set to '2020-02-09T09:00'

See Also