From a6c3844c64171384e7652d7ae33514395a6af294 Mon Sep 17 00:00:00 2001 From: Shivank Kacker Date: Tue, 10 Sep 2024 11:26:20 +0530 Subject: [PATCH] changes --- .../patient_spec/patient_consultation.cy.ts | 4 +- .../pageobject/Patient/PatientConsultation.ts | 2 +- .../Patient/PatientTreatmentPlan.ts | 2 +- src/Components/Common/DateInputV2.tsx | 49 +------------------ 4 files changed, 5 insertions(+), 52 deletions(-) diff --git a/cypress/e2e/patient_spec/patient_consultation.cy.ts b/cypress/e2e/patient_spec/patient_consultation.cy.ts index a27d560e1a0..41c4368e8ef 100644 --- a/cypress/e2e/patient_spec/patient_consultation.cy.ts +++ b/cypress/e2e/patient_spec/patient_consultation.cy.ts @@ -182,12 +182,12 @@ describe("Patient Consultation in multiple combination", () => { patientConsultationPage.typeCauseOfDeath("Cause of Death"); patientConsultationPage.typePatientConsultationDate( "#death_datetime", - "2024-02-22T12:45", + "22/02/2024 12:30 pm", ); patientConsultationPage.typeDeathConfirmedBy(doctorName); patientConsultationPage.typePatientConsultationDate( "#encounter_date", - "2024-02-22T12:30", + "22/02/2024 12:30 pm", ); cy.submitButton("Create Consultation"); cy.verifyNotification( diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index e4a9810141e..4fe42f44d14 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -60,7 +60,7 @@ export class PatientConsultationPage { } typePatientConsultationDate(selector: string, date: string) { - cy.get(selector).clear().click().type(date); + cy.get(selector).click().clear().type(date); } clickPatientDetails() { diff --git a/cypress/pageobject/Patient/PatientTreatmentPlan.ts b/cypress/pageobject/Patient/PatientTreatmentPlan.ts index 70af5604776..82b3abda54c 100644 --- a/cypress/pageobject/Patient/PatientTreatmentPlan.ts +++ b/cypress/pageobject/Patient/PatientTreatmentPlan.ts @@ -33,7 +33,7 @@ class PatientTreatmentPlan { } typeProcedureTime(time: string) { - cy.get("#procedure-time").type(time); + cy.get("#procedure-time").click().type(time); } typeTreatmentPlan(treatment: string) { diff --git a/src/Components/Common/DateInputV2.tsx b/src/Components/Common/DateInputV2.tsx index 3d431fcbd7d..da2a466d37d 100644 --- a/src/Components/Common/DateInputV2.tsx +++ b/src/Components/Common/DateInputV2.tsx @@ -353,54 +353,7 @@ const DateInputV2: React.FC = ({ //close(); setIsOpen?.(false); } - let value = e.target.value.replace(/[^\d]/g, ""); - - // Apply formatting for DD/MM/YYYY hh:mm a - if (value.length > 2 && value.length <= 4) { - value = value.slice(0, 2) + "/" + value.slice(2); - } else if (value.length > 4 && value.length <= 8) { - value = - value.slice(0, 2) + - "/" + - value.slice(2, 4) + - "/" + - value.slice(4); - } else if (value.length > 8 && value.length <= 10) { - value = - value.slice(0, 2) + - "/" + - value.slice(2, 4) + - "/" + - value.slice(4, 8) + - " " + - value.slice(8); - } else if (value.length > 10 && value.length <= 12) { - value = - value.slice(0, 2) + - "/" + - value.slice(2, 4) + - "/" + - value.slice(4, 8) + - " " + - value.slice(8, 10) + - ":" + - value.slice(10); - } else if (value.length > 12) { - value = - value.slice(0, 2) + - "/" + - value.slice(2, 4) + - "/" + - value.slice(4, 8) + - " " + - value.slice(8, 10) + - ":" + - value.slice(10, 12) + - " " + - value.slice(12); - } - - setEditingText(value); + setEditingText(e.target.value); }} onBlur={() => setEditingText(null)} />