From 96bac3752740ac0af94df8d1afb486e280e4df25 Mon Sep 17 00:00:00 2001 From: snehar-nd Date: Fri, 5 Jun 2026 13:18:28 +0530 Subject: [PATCH 1/3] fix: correct EDD calculation when LMP date overflows month boundary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When adding 7 days to LMP caused a month overflow (e.g. Dec 25 → Jan 1), setMonth was still using the original LMP month, producing a wrong EDD. Now both setDate and setMonth operate on eddDate directly. Co-Authored-By: Claude Sonnet 4.6 --- .../ben-registration/ben-registration.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/app-modules/associate-anm-mo/beneficiary-registration/ben-registration/ben-registration.component.ts b/src/app/app-modules/associate-anm-mo/beneficiary-registration/ben-registration/ben-registration.component.ts index 4a27a58..addcb69 100644 --- a/src/app/app-modules/associate-anm-mo/beneficiary-registration/ben-registration/ben-registration.component.ts +++ b/src/app/app-modules/associate-anm-mo/beneficiary-registration/ben-registration/ben-registration.component.ts @@ -650,8 +650,8 @@ import { AmritTrackingService } from 'Common-UI/src/tracking'; if (this.benRegistrationForm.controls.lmpDate.value !== null) { const eddDate = new Date(this.benRegistrationForm.controls.lmpDate.value); - eddDate.setDate(this.benRegistrationForm.controls.lmpDate.value.getDate() + 7); - eddDate.setMonth(this.benRegistrationForm.controls.lmpDate.value.getMonth() + 9); + eddDate.setDate(eddDate.getDate() + 7); + eddDate.setMonth(eddDate.getMonth() + 9); this.benRegistrationForm.patchValue({ edd: eddDate }) } else { console.log("EDD VALUE", this.benRegistrationForm.controls.edd.value); From 93495320ed206819372ea4e8194006485e3fa408 Mon Sep 17 00:00:00 2001 From: Sneha Date: Tue, 16 Jun 2026 12:52:13 +0530 Subject: [PATCH 2/3] fix: amm-2339 ecd date mismatch in lmp and eod --- .../ben-registration/ben-registration.component.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/app/app-modules/associate-anm-mo/beneficiary-registration/ben-registration/ben-registration.component.ts b/src/app/app-modules/associate-anm-mo/beneficiary-registration/ben-registration/ben-registration.component.ts index addcb69..1b0caf4 100644 --- a/src/app/app-modules/associate-anm-mo/beneficiary-registration/ben-registration/ben-registration.component.ts +++ b/src/app/app-modules/associate-anm-mo/beneficiary-registration/ben-registration/ben-registration.component.ts @@ -289,10 +289,9 @@ import { AmritTrackingService } from 'Common-UI/src/tracking'; // eDate = new Date(eDate.getTime() + eDate.getTimezoneOffset() * 60000) // this.benRegistrationForm.controls.edd.setValue(eDate); - // Calculate EDD based on LMP Date - const eddDate = new Date(lDate); - eddDate.setDate(eddDate.getDate() + 7); // Add 7 days - eddDate.setMonth(eddDate.getMonth() + 9); // Add 9 months + // Calculate EDD based on LMP Date (Naegele's rule: LMP + 9 months + 7 days) + // Using Date constructor to safely handle day/month overflow in one step + const eddDate = new Date(lDate.getFullYear(), lDate.getMonth() + 9, lDate.getDate() + 7); console.log("EDD FORM VALUE FIRST", this.benRegistrationForm); this.benRegistrationForm.controls.edd.setValue(eddDate); console.log("EDD PATCHING VALUE", eddDate); @@ -649,9 +648,8 @@ import { AmritTrackingService } from 'Common-UI/src/tracking'; calculateEdd() { if (this.benRegistrationForm.controls.lmpDate.value !== null) { - const eddDate = new Date(this.benRegistrationForm.controls.lmpDate.value); - eddDate.setDate(eddDate.getDate() + 7); - eddDate.setMonth(eddDate.getMonth() + 9); + const lmpVal = new Date(this.benRegistrationForm.controls.lmpDate.value); + const eddDate = new Date(lmpVal.getFullYear(), lmpVal.getMonth() + 9, lmpVal.getDate() + 7); this.benRegistrationForm.patchValue({ edd: eddDate }) } else { console.log("EDD VALUE", this.benRegistrationForm.controls.edd.value); From 3f8efeafe1739be6d800158e0b2d0d5429294653 Mon Sep 17 00:00:00 2001 From: SnehaRH <77656297+snehar-nd@users.noreply.github.com> Date: Tue, 30 Jun 2026 11:43:26 +0530 Subject: [PATCH 3/3] Update version from 3.6.0 to 3.7.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 48a3cef..c5c4db7 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.iemr.ecd-ui ecd-ui - 3.6.0 + 3.7.1 ECD-UI war