Skip to content

Commit

Permalink
fixed warranty label date
Browse files Browse the repository at this point in the history
  • Loading branch information
GokulramGHV committed Oct 6, 2023
1 parent 1c729c6 commit 4bb6911
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Components/Assets/AssetsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,10 @@ export const warrantyAmcValidityChip = (
const today = new Date();
const warrantyAmcEndDate = new Date(warranty_amc_end_of_validity);

const days = Math.ceil(
Math.abs(Number(warrantyAmcEndDate) - Number(today)) / (1000 * 60 * 60 * 24)
);

if (warrantyAmcEndDate < today) {
return (
<Chip
Expand All @@ -517,9 +521,7 @@ export const warrantyAmcValidityChip = (
text="AMC/Warranty Expired"
/>
);
} else if (
warrantyAmcEndDate < new Date(today.setMonth(today.getMonth() + 1))
) {
} else if (days <= 30) {
return (
<Chip
variant="custom"
Expand All @@ -528,9 +530,7 @@ export const warrantyAmcValidityChip = (
text="AMC/Warranty Expiring Soon"
/>
);
} else if (
warrantyAmcEndDate < new Date(today.setMonth(today.getMonth() + 3))
) {
} else if (days <= 90) {
return (
<Chip
variant="warning"
Expand Down

0 comments on commit 4bb6911

Please sign in to comment.