dateOnly method Null safety

DateTime dateOnly(
  1. DateTime date
)

Returns a DateTime with the date of the original, but time set to midnight.

Implementation

static DateTime dateOnly(DateTime date) {
  return DateTime(date.year, date.month, date.day);
}