🚀 Flutter_Extend Version 0.2.1 is now live! See our changelog for details.
Instantly check if a DateTime falls on today, yesterday, tomorrow, or in the past/future, ignoring time components for calendar accuracy.
final today = DateTime.now(); print(today.isToday()); // true
final yesterday = myDate.subtract(const Duration(days: 1)); print(yesterday.isYesterday()); // true
final tomorrow = myDate.add(const Duration(days: 1)); print(tomorrow.isTomorrow()); // true
DateTime.now()
print(DateTime(2000, 1, 1).isPast()); // true
final reminder = DateTime.now().add(const Duration(hours: 1)); print(reminder.isFuture()); // true
Was this page helpful?