Skip to content

FINERACT-2512: Clamp invalid fee month/day on read to avoid 500 (e.g. Feb 30 → Feb 29)#5559

Open
oluexpert99 wants to merge 2 commits intoapache:developfrom
TECHSERVICES-LIMITED:bugfix/FINERACT-2512
Open

FINERACT-2512: Clamp invalid fee month/day on read to avoid 500 (e.g. Feb 30 → Feb 29)#5559
oluexpert99 wants to merge 2 commits intoapache:developfrom
TECHSERVICES-LIMITED:bugfix/FINERACT-2512

Conversation

@oluexpert99
Copy link
Contributor

Description

  • Add DateUtils.safeMonthDay(month, day) to clamp day to last valid day of month
  • Use safeMonthDay in charge and standing-instruction read services when mapping
    fee_on_month/fee_on_day and recurrence month/day from DB
  • Prevents DateTimeException (e.g. "day 30 not valid for February") when reading
    savings product with template, standing instructions, or savings account charges
  • Add unit tests for safeMonthDay; add ticket doc for JIRA

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Write the commit message as per our guidelines
  • Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
  • Create/update unit or integration tests for verifying the changes made.
  • Follow our coding conventions.
  • Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
  • This PR must not be a "code dump". Large changes can be made in a branch, with assistance. Ask for help on the developer mailing list.

Your assigned reviewer(s) will follow our guidelines for code reviews.

@IOhacker
Copy link
Contributor

@oluexpert99 squash and commit

@IOhacker
Copy link
Contributor

@oluexpert99 sign your commit

Copy link
Contributor

@IOhacker IOhacker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kindly see my comments

@oluexpert99 oluexpert99 force-pushed the bugfix/FINERACT-2512 branch 2 times, most recently from c75cd8d to a59f40f Compare February 28, 2026 08:51
@oluexpert99
Copy link
Contributor Author

Kindly see my comments

@IOhacker , done

@IOhacker
Copy link
Contributor

IOhacker commented Mar 1, 2026

@oluexpert99 could you please review the log output.

Copy link
Contributor

@IOhacker IOhacker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +496 to +499
public static MonthDay safeMonthDay(int month, int day) {
int maxDay = YearMonth.of(2024, month).lengthOfMonth();
int safeDay = Math.min(day, maxDay);
return MonthDay.of(month, safeDay);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having Feb 29 is just as bad as having feb 30 or feb 31... leap years has only feb 29 only... so from 4 years 3 has feb 28 only, i dont see any improvement here...

Am I missing something here?

Copy link
Contributor

@adamsaghy adamsaghy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my concerns!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants