TF-46 Create object, builder for model and core module

This commit is contained in:
dab246
2021-08-26 17:03:04 +07:00
committed by Dat H. Pham
parent b70fc6edb8
commit 17bad5ec51
21 changed files with 203 additions and 12 deletions
@@ -16,3 +16,21 @@ extension DateTimeExtension on DateTime {
return now.year == this.year;
}
}
extension DateTimeNullableExtension on DateTime? {
String toPattern() {
if (this != null) {
if (this!.isToday()) {
return 'h:mm a';
} else if (this!.isYesterday()) {
return 'EEE';
} else if (this!.isThisYear()) {
return 'MMMd';
} else {
return 'yMMMd';
}
}
return 'yMMMd';
}
}