Add object for model and core module
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
|
||||
extension DateTimeExtension on DateTime {
|
||||
|
||||
bool isToday() {
|
||||
final now = DateTime.now();
|
||||
return now.day == this.day && now.month == this.month && now.year == this.year;
|
||||
}
|
||||
|
||||
bool isYesterday() {
|
||||
final yesterday = DateTime.now().subtract(Duration(days: 1));
|
||||
return yesterday.day == this.day && yesterday.month == this.month && yesterday.year == this.year;
|
||||
}
|
||||
|
||||
bool isThisYear() {
|
||||
final now = DateTime.now();
|
||||
return now.year == this.year;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user