Refactors

This commit is contained in:
2024-09-10 15:09:15 -06:00
parent aa71e8a9e6
commit fe40731e09
19 changed files with 791 additions and 708 deletions
+32
View File
@@ -0,0 +1,32 @@
import 'package:intl/intl.dart';
class DateRange {
DateRange({required this.start, required this.end});
final DateTime? start;
final DateTime? end;
@override
String toString() {
final DateFormat dateFormat = DateFormat("MMM yyyy");
if (start == null && end == null) {
return '';
}
if (start == null && end != null) {
return dateFormat.format(end!);
}
if (start != null && end == null) {
return "${dateFormat.format(start!)} - Current";
}
return "${dateFormat.format(start!)} - ${dateFormat.format(end!)}";
}
@override
int get hashCode {
return Object.hashAll([start, end]);
}
@override
bool operator ==(Object other) {
return super.hashCode == other.hashCode;
}
}