Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
PFM-5064 fix daysToSub
Browse files Browse the repository at this point in the history
  • Loading branch information
rahuldevgarg committed Mar 5, 2024
1 parent 45822c3 commit 7f6db5b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions frontend/mgramseva/lib/utils/common_methods.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,17 @@ class CommonMethods {
return false;
}
}
static int daysToSub(int monthCount, int year) {
var days = 0;
static int daysToSubtract(int monthCount, int year,int currentMonth) {
int days = 0;
for (int i = 0; i < monthCount; i++) {
if (isLeapYear(year)) {
days += daysInMonthLeap[i];
if (currentMonth - i < 0) {
days += isLeapYear(year - 1)
? daysInMonthLeap[12 - (currentMonth - i).abs()]
: daysInMonth[12 - (currentMonth - i).abs()];
} else {
days += daysInMonth[i];
days += isLeapYear(year)
? daysInMonthLeap[currentMonth - i]
: daysInMonth[currentMonth - i];
}
}
return days;
Expand Down

0 comments on commit 7f6db5b

Please sign in to comment.