diff --git a/package-lock.json b/package-lock.json index 84a5ec2..f52265c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@angular/core": "^16.2.0", "@angular/forms": "^16.2.0", "@angular/material": "^16.2.12", + "@angular/material-moment-adapter": "^18.0.6", "@angular/platform-browser": "^16.2.12", "@angular/platform-browser-dynamic": "^16.2.0", "@angular/router": "^16.2.0", @@ -945,6 +946,19 @@ "rxjs": "^6.5.3 || ^7.4.0" } }, + "node_modules/@angular/material-moment-adapter": { + "version": "18.0.6", + "resolved": "https://registry.npmjs.org/@angular/material-moment-adapter/-/material-moment-adapter-18.0.6.tgz", + "integrity": "sha512-cNGYGQhIsTw1qxpKUK9iTRxEcdzndLhDvkBIGwpIDf0ovtOsTeEEhqC3rESN9U19yKVmMppljedhv3MhNALS+w==", + "dependencies": { + "tslib": "^2.3.0" + }, + "peerDependencies": { + "@angular/core": "^18.0.0 || ^19.0.0", + "@angular/material": "18.0.6", + "moment": "^2.18.1" + } + }, "node_modules/@angular/platform-browser": { "version": "16.2.12", "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-16.2.12.tgz", @@ -18461,6 +18475,14 @@ "tslib": "^2.3.0" } }, + "@angular/material-moment-adapter": { + "version": "18.0.6", + "resolved": "https://registry.npmjs.org/@angular/material-moment-adapter/-/material-moment-adapter-18.0.6.tgz", + "integrity": "sha512-cNGYGQhIsTw1qxpKUK9iTRxEcdzndLhDvkBIGwpIDf0ovtOsTeEEhqC3rESN9U19yKVmMppljedhv3MhNALS+w==", + "requires": { + "tslib": "^2.3.0" + } + }, "@angular/platform-browser": { "version": "16.2.12", "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-16.2.12.tgz", diff --git a/package.json b/package.json index 432c71f..b327d88 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "@angular/core": "^16.2.0", "@angular/forms": "^16.2.0", "@angular/material": "^16.2.12", + "@angular/material-moment-adapter": "^18.0.6", "@angular/platform-browser": "^16.2.12", "@angular/platform-browser-dynamic": "^16.2.0", "@angular/router": "^16.2.0", diff --git a/src/app/app-modules/nurse-doctor/anc/anc-details/anc-details.component.html b/src/app/app-modules/nurse-doctor/anc/anc-details/anc-details.component.html index e619d1c..93f1ad8 100644 --- a/src/app/app-modules/nurse-doctor/anc/anc-details/anc-details.component.html +++ b/src/app/app-modules/nurse-doctor/anc/anc-details/anc-details.component.html @@ -35,7 +35,6 @@ ng-readonly="true" (dateChange)="checkupLMP(lmpDate)" /> - MM/DD/YYYY - MM/DD/YYYY checkdate && lmpDate < today) { - this.patientANCDetailsForm.patchValue({ duration: null }); - this.calculateEDD(lmpDate); - this.calculateGestationalAge(lmpDate); - this.calculatePeriodOfPregnancy(lmpDate); - this.nurseService.setLMPForFetosenseTest(lmpDate); + const lmpDateJS = lmpDate.toDate(); + + if (lmpDateJS > checkdate && lmpDateJS < today) { + this.patientANCDetailsForm.patchValue({ + lmpDate: lmpDateJS, + duration: null, + }); + this.calculateEDD(lmpDateJS); + this.calculateGestationalAge(lmpDateJS); + this.calculatePeriodOfPregnancy(lmpDateJS); } else { lmpDate = null; this.patientANCDetailsForm.patchValue({ lmpDate: lmpDate }); @@ -102,7 +140,6 @@ export class AncDetailsComponent implements OnInit, DoCheck, OnDestroy { this.calculateEDD(lmpDate); this.calculateGestationalAge(lmpDate); this.calculatePeriodOfPregnancy(lmpDate); - this.nurseService.clearLMPForFetosenseTest(); } } @@ -110,9 +147,9 @@ export class AncDetailsComponent implements OnInit, DoCheck, OnDestroy { this.patientANCDetailsForm.patchValue({ duration: null }); } - calculateGestationalAge(lastMP: any) { + calculateGestationalAge(lastMP: Date) { let gestationalAge: any; - if (lastMP !== null) { + if (lastMP instanceof Date) { const oneDay = 24 * 60 * 60 * 1000; // hours*minutes*seconds*milliseconds gestationalAge = Math.round( Math.abs( @@ -134,8 +171,8 @@ export class AncDetailsComponent implements OnInit, DoCheck, OnDestroy { } } - calculateEDD(lastMP: any) { - if (lastMP !== null) { + calculateEDD(lastMP: Date) { + if (lastMP instanceof Date) { const edd = new Date(lastMP); edd.setDate(lastMP.getDate() + 280); this.patientANCDetailsForm.patchValue({ expDelDt: edd }); diff --git a/src/app/app-modules/nurse-doctor/anc/anc-immunization/anc-immunization.component.html b/src/app/app-modules/nurse-doctor/anc/anc-immunization/anc-immunization.component.html index 3a0880d..a32fa58 100644 --- a/src/app/app-modules/nurse-doctor/anc/anc-immunization/anc-immunization.component.html +++ b/src/app/app-modules/nurse-doctor/anc/anc-immunization/anc-immunization.component.html @@ -41,7 +41,6 @@ [matDatepicker]="dateReceivedForTT_1Picker" (dateChange)="checkTT_1Date(dateReceivedForTT_1)" /> - MM/DD/YYYY - MM/DD/YYYY - MM/DD/YYYY formControlName="dateOfDeath" [min]="minimumDeathDate" /> - MM/DD/YYYY formControlName="dateOfDeath" [min]="minimumDeathDate" /> - MM/DD/YYYY - MM/DD/YYYY formControlName="nextScreeningDate" [min]="nextScreeningDate" /> - MM/DD/YYYY {{ currentLanguageSet?.pncData?.pnc }} [min]="minimumDeliveryDate" [matDatepicker]="dodicker" /> - MM/DD/YYYY {{ currentLanguageSet?.Referdetails?.refer }} [min]="tomorrow" (change)="checkdate(revisitDate)" /> - MM/DD/YYYY {{ currentLanguageSet?.Referdetails?.revisitAndRefer }} [min]="tomorrow" (change)="checkdate(revisitDate)" /> - MM/DD/YYYY {{ currentLanguageSet?.common?.scheduler }} [matDatepicker]="schedulerDatePicker" (change)="getMasterSpecialization()" /> - MM/DD/YYYY - MM/DD/YYYY {{ currentLanguageSet?.common?.advanceBeneficiarySearch }} [matDatepicker]="picker" formControlName="dob" /> - MM/DD/YYYY