This commit is contained in:
Hamza-Ayed
2024-07-01 12:51:26 +03:00
parent 475ba12cde
commit d9305b771f
3 changed files with 6 additions and 6 deletions

View File

@@ -40,14 +40,14 @@ class AI extends GetxController {
// Get the inspection date from the response
final inspectionDate = responseIdCardDriverEgyptBack['inspection_date'];
final year = int.parse(inspectionDate.split('-')[0]);
// Try parsing the tax expiry date. If it fails, set it to null.
final taxExpiryDateTime = DateTime.tryParse(taxExpiryDate ?? '');
final isExpiredCar =
taxExpiryDateTime != null && taxExpiryDateTime.isBefore(today);
// Check if the inspection date is before today
final inspectionDateTime = DateTime(int.parse(inspectionDate ?? ''), 1, 1);
final inspectionDateTime = DateTime(year, 1, 1);
final isInspectionExpired = inspectionDateTime.isBefore(today);
if (isExpiredCar || isInspectionExpired) {