You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "mohitsinha (via GitHub)" <gi...@apache.org> on 2023/04/11 09:11:21 UTC

[GitHub] [fineract] mohitsinha commented on a diff in pull request #3109: FINERACT-1919: Fix monthly loan schedule due dates to maximize accord…

mohitsinha commented on code in PR #3109:
URL: https://github.com/apache/fineract/pull/3109#discussion_r1162523268


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/service/CalendarUtils.java:
##########
@@ -90,36 +90,13 @@ public static LocalDate getNextRecurringDate(final String recurringRule, final L
     }
 
     public static Temporal adjustDate(final Temporal date, final Temporal seedDate, final PeriodFrequencyType frequencyType) {
-        Temporal adjustedVal = date;
-        if (frequencyType.isMonthly() && seedDate.get(ChronoField.DAY_OF_MONTH) > 28 && date.get(ChronoField.DAY_OF_MONTH) > 28) {
-            switch (date.get(ChronoField.MONTH_OF_YEAR)) {
-                case 2:
-                    if (IsoChronology.INSTANCE.isLeapYear(date.get(ChronoField.YEAR))) {
-                        adjustedVal = date.with(ChronoField.DAY_OF_MONTH, 29);
-                    }
-                break;
-                case 4:
-                case 6:
-                case 9:
-                case 11:
-                    if (seedDate.get(ChronoField.DAY_OF_MONTH) > 30) {
-                        adjustedVal = date.with(ChronoField.DAY_OF_MONTH, 30);
-                    } else {
-                        adjustedVal = date.with(ChronoField.DAY_OF_MONTH, seedDate.get(ChronoField.DAY_OF_MONTH));
-                    }
-                break;
-                case 1:
-                case 3:
-                case 5:
-                case 7:
-                case 8:
-                case 10:
-                case 12:
-                    adjustedVal = date.with(ChronoField.DAY_OF_MONTH, seedDate.get(ChronoField.DAY_OF_MONTH));
-                break;
-            }
+        if (frequencyType.isMonthly() && seedDate.get(ChronoField.DAY_OF_MONTH) > 28 && date.get(ChronoField.DAY_OF_MONTH) >= 28) {

Review Comment:
   @adamsaghy Yes it was intentional, otherwise this logic wouldn't get applied for non-leap years.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org