dateOnly static method

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) {
  final DateTime now = DateTime.now();

  return DateTime.utc(now.year, now.month, now.day);
}