1
0
mirror of https://github.com/flutter/samples.git synced 2026-05-07 07:26:08 +00:00
Files
samples/experimental/web_dashboard/lib/src/utils/day_helpers.dart
2021-06-05 12:24:28 +10:00

16 lines
564 B
Dart

// Copyright 2020, the Flutter project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
extension DayUtils on DateTime {
/// The UTC date portion of a datetime, without the minutes, seconds, etc.
DateTime get atMidnight {
return DateTime.utc(year, month, day);
}
/// Checks that the two [DateTime]s share the same date.
bool isSameDay(DateTime d2) {
return year == d2.year && month == d2.month && day == d2.day;
}
}