truncate method

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

Returns a copy of this truncated to the TemporalUnit.

final date = LocalDateTime(2023, 4, 15, 3, 40);
date.truncate(to: DateUnit.months); // 2023-04-01 00:00

Implementation

@useResult LocalDateTime truncate({required TemporalUnit to}) => LocalDateTime._(_native.truncate(to: to));