operator + method

  1. @useResult
ZonedDateTime operator +(
  1. Period period
)

Returns a copy of this with the period added.

This function adds the conceptual units of time unlike add.

// DST occurs at 2023-03-12 02:00
// https://www.timeanddate.com/time/change/usa/detroit?year=2023

final foo = ZonedDateTime('America/Detroit', 2023, 3, 12);

foo + Period(days: 1);      // 2023-03-13T00:00-04:00[America/Detroit]
foo.add(Duration(days: 1)); // 2023-03-13T01:00-04:00[America/Detroit]

Implementation

@useResult ZonedDateTime operator + (Period period) => ZonedDateTime._convert(timezone, _native + period);