checkBefore method
Implementation
bool checkBefore({required DateTime target}) {
bool checkYear = false;
bool checkMonth = false;
bool checkDay = false;
if (this.year == target.year) {
checkYear = true;
if (this.month == target.month) {
checkMonth = true;
if (this.day < target.day) {
checkDay = false;
} else {
checkDay = true;
}
} else if (this.month > target.month) {
checkMonth = true;
checkDay = true;
}
} else if (this.year > target.year) {
checkYear = true;
checkMonth = true;
checkDay = true;
}
return checkYear && checkMonth && checkDay;
}