truncate method

  1. @useResult
DateTime truncate({
  1. required TemporalUnit to,
})

Returns a copy of this truncated to the TemporalUnit.

DateTime(2023, 4, 15).truncate(to: DateUnit.months); // 2023-04-01 00:00

Implementation

@useResult DateTime truncate({required TemporalUnit to}) => _adjust(to, (time) => time);