rk-roshan-kr opened a new pull request, #731:
URL: https://github.com/apache/fineract-backoffice-ui/pull/731

   ### Problem
   
   When activating or closing centers (and other date-bound entities), the 
action dialog seeded its initial date from the browser's local clock (`new 
Date()`). Fineract validates and processes dates against the tenant's timezone 
(by default `Asia/Kolkata`, UTC+5:30) or its configured business date.
   
   For users accessing the backoffice from a timezone behind the tenant (such 
as UTC), the browser clock offers yesterday's date during evening hours (e.g. 
18:30 to 24:00 UTC). When submitting an activation date that is before the 
entity's submission date in the tenant timezone, Fineract rejects the request 
with:
   `error.msg.group.submittedOnDate.after.activation.date`
   
   Furthermore:
   1. `CenterViewComponent` previously caught submission errors and replaced 
them with a generic `COMMON.ERROR` toast, masking the backend's validation 
message and parameter arguments.
   2. `errorInterceptor` logged error response bodies to console but did not 
display scalar validation parameters (e.g., the refused date) in toast 
notifications.
   3. `playwright.config.ts` had pinned `timezoneId: 'Asia/Kolkata'` to mask 
this mismatch in end-to-end tests.
   
   ### Solution
   
   1. **Platform Date Resolution (`PlatformDateService` & ADR 0006 Adapter)**:
      - Created `BusinessDateApi` / `FineractBusinessDateApi` adapter adhering 
strictly to the generated API boundary in ADR 0006.
      - Created `PlatformDateService` to resolve today's date from `GET 
/v1/businessdate` (`type === 'BUSINESS_DATE'`), falling back to today in the 
tenant's timezone (`AppConfig.tenantTimezone`, defaulting to `Asia/Kolkata`), 
and finally falling back to the local calendar date.
      - Added `getDateWithFloor(floor?: string)` to return the later of today 
or the minimum required timeline date using lexical ISO comparison 
(`YYYY-MM-DD`).
   
   2. **Center Dialog Seeding & Bounds**:
      - Updated `CenterActionDialogComponent` to seed dates via 
`PlatformDateService.getDateWithFloor(minDate)`.
      - Set `[min]="minDate"` on the dialog's `ion-datetime` to prevent 
selecting a date earlier than submission/activation.
      - Updated `CenterViewComponent` to pass `submittedOnDate` for activation 
and `activatedOnDate` for closure.
   
   3. **Backend Validation Transparency**:
      - Removed duplicate generic error toasts in `CenterViewComponent`, 
letting `errorInterceptor` handle errors.
      - Updated `errorInterceptor` to format scalar parameter arguments (e.g., 
the refused date) in validation toast notifications (`• [param] message (arg)`).
   
   4. **Testing & Configuration**:
      - Removed the `timezoneId: 'Asia/Kolkata'` pin from 
`playwright.config.ts`.
      - Added comprehensive unit tests for `PlatformDateService`, 
`FineractBusinessDateApi`, `CenterActionDialogComponent`, 
`CenterViewComponent`, and `errorInterceptor`.
   
   Fixes #358
   


-- 
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