Skip to content

Commit

Permalink
feat: save dates as UTC but view as international date format
Browse files Browse the repository at this point in the history
  • Loading branch information
danielstefanequilobe committed Jun 7, 2022
1 parent 802e931 commit 59e9b5b
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/utils/functionUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ export const handleClickLink = link => {
};

const stagingIssuanceViewInfo = (info, dataType, changeColor) => {
if (_.isEmpty(info[dataType]?.changes) && info[dataType]?.original) {
return (
<Body color={changeColor(dataType, 'INSERT')}>
{info[dataType]?.original}
</Body>
);
} else if (info[dataType]?.changes[0] && info[dataType]?.original) {
const isDate = dataType.toLowerCase().includes('date');
const changedValue = !isDate
? info[dataType]?.changes[0]
: getISODate(info[dataType]?.changes[0]);
const initialValue = !isDate
? info[dataType]?.original
: getISODate(info[dataType]?.original);

if (_.isEmpty(info[dataType]?.changes) && initialValue) {
return <Body color={changeColor(dataType, 'INSERT')}>{initialValue}</Body>;
} else if (changedValue && initialValue) {
return (
<>
<Body color={changeColor(dataType, 'INSERT')}>
{info[dataType]?.changes[0]}
</Body>
<Body color={changeColor(dataType, 'DELETE')}>
{info[dataType]?.original}
</Body>
<Body color={changeColor(dataType, 'INSERT')}>{changedValue}</Body>
<Body color={changeColor(dataType, 'DELETE')}>{initialValue}</Body>
</>
);
} else if (info[dataType]?.changes[0] === '' && info[dataType]?.original) {
return <Body>{info[dataType]?.original}</Body>;
} else if (changedValue === '' && initialValue) {
return <Body>{initialValue}</Body>;
}
};

Expand Down

0 comments on commit 59e9b5b

Please sign in to comment.