Share via


QueryTimeInterval type

Time Interval type for specifying timespan for querying logs and metrics. A time interval is the intervening time between two time points. The amount of intervening time is expressed by a duration The two time points (start and end) are expressed by either a combined date and time representation or just a date representation.There are four ways to express a time interval:

  • duration
  • start time, end time
  • start time, duration
  • duration, end time

The duration is an ISO8601 duration value in the format P[n]Y[n]M[n]DT[n]H[n]M[n]S where P is the duration designator (for period) placed at the start of the duration representation. Y is the year designator that follows the value for the number of years. M is the month designator that follows the value for the number of months. W is the week designator that follows the value for the number of weeks. D is the day designator that follows the value for the number of days. T is the time designator that precedes the time components of the representation. H is the hour designator that follows the value for the number of hours. M is the minute designator that follows the value for the number of minutes. S is the second designator that follows the value for the number of seconds.

type QueryTimeInterval =
  | { endTime: Date; startTime: Date }
  | { duration: string; startTime: Date }
  | { duration: string; endTime: Date }
  | { duration: string }