Skip to content

Commit

Permalink
Update get-cipp-formatting.js
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnDuprey committed Dec 31, 2024
1 parent 1cfb8a1 commit c08859b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/utils/get-cipp-formatting.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ export const getCippFormatting = (data, cellName, type, canReceive) => {
"commitmentTerm.renewalConfiguration.renewalDate",
"purchaseDate",
];
if (timeAgoArray.includes(cellName)) {

const matchDateTime = /[dD]ate[tT]ime/;
if (timeAgoArray.includes(cellName) || matchDateTime.test(cellName)) {
return isText && canReceive === false ? (
new Date(data).toLocaleString() // This runs if canReceive is false and isText is true
) : isText && canReceive !== "both" ? (
Expand Down Expand Up @@ -240,13 +242,6 @@ export const getCippFormatting = (data, cellName, type, canReceive) => {
return isText ? data : <Chip variant="outlined" label={data} size="small" color="info" />;
}

if (cellName === "@odata.type") {
if (data.startsWith("#microsoft.graph")) {
data = data.replace("#microsoft.graph.", "");
}
return getCippTranslation(data, "odataType");
}

// Handle null or undefined data
if (data === null || data === undefined) {
return isText ? (
Expand All @@ -258,6 +253,13 @@ export const getCippFormatting = (data, cellName, type, canReceive) => {
);
}

if (cellName === "@odata.type") {
if (data.startsWith("#microsoft.graph")) {
data = data.replace("#microsoft.graph.", "");
}
return getCippTranslation(data, "@odata.type");
}

// Handle From address
if (cellName === "From") {
// split on ; , and create chips per email
Expand Down

0 comments on commit c08859b

Please sign in to comment.