Add object for model and core module

This commit is contained in:
dab246
2021-08-18 17:43:22 +07:00
committed by Dat H. Pham
parent 063fd73fb0
commit 6b31252e7a
22 changed files with 306 additions and 26 deletions
@@ -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;
}
}