Skip to content

Commit

Permalink
feat(utils): 🐛 dob format correction
Browse files Browse the repository at this point in the history
change dob format

ref: #52
  • Loading branch information
anantakumarghosh committed Jun 28, 2024
1 parent 787c72a commit 2fb2559
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/components/basicInfo/BasicInfoCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -100,7 +100,7 @@ export default function BasicInfoCard(props) {
styleClasses={[CoreClasses.ALIGNMENT.JUSTIFY_CONTENT_FLEX_START]}
>
<CustomIconTooltipText
tip={getAge(dob)}
tip={getDOB(dob)}
disableFocusRipple={true}
disableRipple={true}
type={__IconTypes.MATERIAL_OUTLINED_ICON}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,20 @@ export function getAge(birthDate) {
//return the calculated age
return ageString && ageString.length > 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;
}

0 comments on commit 2fb2559

Please sign in to comment.