Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

FINERACT-3391: Judge a calendar start date on the business date - #7184

Open
naman2627 wants to merge 1 commit into
apache:developfrom
naman2627:FINERACT-3391-calendar-business-date
Open

naman2627 wants to merge 1 commit into
apache:developfrom
naman2627:FINERACT-3391-calendar-business-date

Conversation

@naman2627

Copy link
Copy Markdown
Contributor

Description

Calendar refuses a new meeting start date that is "in the past", and decides what is past from the
system clock:

// Calendar.updateStartDateAndDerivedFeilds, and again in Calendar.update  (before)
final LocalDate currentDate = DateUtils.getLocalDateOfTenant();   // LocalDate.now(tenant zone)
if (DateUtils.isBefore(newMeetingStartDate, currentDate)) {
    throw new CalendarDateException("new.start.date.cannot.be.in.past", ...);
}

Everything around it uses the business date:

  • DateUtils.isDateInTheFuture(date) is isAfterBusinessDate(date) — the platform's own definition
    of the future.
  • MeetingWriteServiceImpl refuses a meeting dated after DateUtils.getBusinessLocalDate().
  • MeetingsApiResource generates recurring dates up to DateUtils.getBusinessLocalDate().

When it bites

With the business date behind the system date — the normal state during catch-up or end-of-day
processing — a start date that is valid for meetings, on or after the business date, is rejected as
being in the past, so the calendar cannot be moved to the date its own meetings are being written on.
With the business date ahead of the system date, a date the platform treats as past is accepted.

Changes

  • Both validations judge the new start date against DateUtils.getBusinessLocalDate().
  • Three unit tests in fineract-core: a start date on the business date and one after it are
    accepted, one before it is refused. The first two fail against the unfixed code, because with the
    business date set behind the system date they are "past" by the system clock.

Whole-module runs after the change: :fineract-core:test 672 tests, and the provider's calendar
tests, 63 tests, both green.

Not included

CalendarUtils and CalendarReadPlatformServiceImpl also derive a current date from the system
clock when generating recurring dates. Whether recurrence generation should follow the business date
is a wider question and is left out of this change.

Checklist

  • 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 — n/a, no API change
  • 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.
  • If merging this PR resolves a JIRA issue, I will mark that issue as resolved and set "Fix Version/s" appropriately.
  • I followed the AI Policy.

Calendar refuses a new meeting start date that is in the past and took "now"
from the system clock, through DateUtils.getLocalDateOfTenant, in both
updateStartDateAndDerivedFeilds and update. Everything around it uses the
business date: DateUtils.isDateInTheFuture is isAfterBusinessDate,
MeetingWriteServiceImpl refuses a meeting after the business date, and
MeetingsApiResource generates recurring dates up to it.

With the business date behind the system date, which is the normal state
during catch-up or end-of-day processing, a start date that is valid for
meetings was rejected as past, so a calendar could not be moved to the date its
own meetings were being written on. With the business date ahead, a date the
platform treats as past was accepted.

Judge both against DateUtils.getBusinessLocalDate.

The recurrence generation in CalendarUtils and CalendarReadPlatformServiceImpl
also derives a current date from the system clock. That is a wider question
about recurrence and is left alone here.

Assisted-By: Claude Code
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.

1 participant