diff --git a/src/Components/Assets/AssetsList.tsx b/src/Components/Assets/AssetsList.tsx index b600dbbdc45..46b4da5283d 100644 --- a/src/Components/Assets/AssetsList.tsx +++ b/src/Components/Assets/AssetsList.tsx @@ -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 ( ); - } else if ( - warrantyAmcEndDate < new Date(today.setMonth(today.getMonth() + 1)) - ) { + } else if (days <= 30) { return ( ); - } else if ( - warrantyAmcEndDate < new Date(today.setMonth(today.getMonth() + 3)) - ) { + } else if (days <= 90) { return (