From 2fb2559f009d1a8264cb7548c74ddd57e9d5e516 Mon Sep 17 00:00:00 2001 From: anantakumarghosh Date: Fri, 28 Jun 2024 12:03:09 +0530 Subject: [PATCH] feat(utils): :bug: dob format correction change dob format ref: #52 --- app/components/basicInfo/BasicInfoCard.js | 4 ++-- .../helper.js => functions/helper.functions.js} | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) rename app/{components/utils/helper.js => functions/helper.functions.js} (82%) diff --git a/app/components/basicInfo/BasicInfoCard.js b/app/components/basicInfo/BasicInfoCard.js index 33bf3ab..0671903 100644 --- a/app/components/basicInfo/BasicInfoCard.js +++ b/app/components/basicInfo/BasicInfoCard.js @@ -14,7 +14,7 @@ import { } from "@wrappid/core"; import { useSelector } from "react-redux"; -import { getAge /**, getFullName */ } from "../utils/helper"; +import { getAge, getDOB } from "../../functions/helper.functions"; export default function BasicInfoCard(props) { const { @@ -100,7 +100,7 @@ export default function BasicInfoCard(props) { styleClasses={[CoreClasses.ALIGNMENT.JUSTIFY_CONTENT_FLEX_START]} > 0 ? ageString : "N/A"; } + +/** + * Function to return the age of the person + * in dd month yyyy format + * @param {*} data + * @returns {formatted date} + */ +export function getDOB(data){ + + const dateStr = data; + const date = new Date(dateStr); + + const options = { day: "2-digit", month: "long", year: "numeric" }; + const formattedDate = date.toLocaleDateString("en-US", options); + + return formattedDate; +}