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


##########
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 This is exactly for the case mentioned in the ticket. 
   Where firstRepaymentDate is 31 Jan 2023, 
   second will be 28 Feb 2023, 
   And for March, the date will be 28 March 2023, if we don't have `>=` this 
logic won't get executed. Hence it is needed for all `dates>=28`



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to