adjustTimeToDateHourOnly method

DateTime adjustTimeToDateHourOnly({
  1. bool isUtc = true,
  2. DateTime? date,
})

Implementation

DateTime adjustTimeToDateHourOnly({bool isUtc = true, DateTime? date}) {
  DateTime convertedDate = date ?? this;
  if (isUtc) {
    convertedDate = convertedDate.toUtc();
  }

  return convertedDate.copyWith(
    minute: 0,
    second: 0,
    millisecond: 0,
    microsecond: 0,
  );
}