ceil method

  1. @Possible({RangeError})
  2. @useResult
ZonedDateTime ceil(
  1. TemporalUnit unit,
  2. int value
)

Returns a copy of this ceiled to the nearest unit and value.

Contract

Throws RangeError if value <= 0.

Example

final foo = ZonedDateTime('Asia/Singapore', 2023, 4, 15);
foo.ceil(DateUnit.months, 6); // 2023-06-01T00:00+08:00[Asia/Singapore]

final bar = ZonedDateTime('Asia/Singapore', 2023, 8, 15);
bar.ceil(DateUnit.months, 6); // 2023-12-01T00:00+08:00[Asia/Singapore]

Implementation

@Possible({RangeError})
@useResult ZonedDateTime ceil(TemporalUnit unit, int value) => ZonedDateTime._convert(timezone, _native.ceil(unit, value));