Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
SayedZeeshanHyder committed Jul 6, 2024
2 parents 2ff9a89 + 76329b3 commit 08041c2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/new_ui/screens/railway_screen/railway_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ class _RailwayConcessionScreenState
DateTime today = DateTime.now();
DateTime lastPass = lastPassIssued;
int diff = today.difference(lastPass).inDays;
bool retVal = (duration == "Monthly" && diff >= 30) ||
(duration == "Quarterly" && diff >= 90);

// eg: if lastPassIssued if 6th June, it expires on 5th June then allow user to apply for pass from 2nd,3rd,4th June, 3days prior to pass ends
bool retVal = (duration == "Monthly" && diff >= 26) ||
(duration == "Quarterly" && diff >= 86);
// debugPrint(retVal.toString());
// debugPrint(status);
return retVal;
Expand All @@ -83,9 +85,12 @@ class _RailwayConcessionScreenState

DateTime today = DateTime.now();
DateTime lastPass = lastPassIssued ?? DateTime.now();
DateTime futurePass = lastPass.add(duration == "Monthly" ? const Duration(days: 30) : const Duration(days: 90));
DateTime futurePass = lastPass.add(duration == "Monthly" ? const Duration(days: 27) : const Duration(days: 87));
int diff = futurePass.difference(today).inDays;

if (diff==1){
return "⚠️ NOTE: You will be able to apply for a new pass only after $diff day";
}
return "⚠️ NOTE: You will be able to apply for a new pass only after $diff days";
}

Expand Down

0 comments on commit 08041c2

Please sign in to comment.