From 859883e1bedefea74bb5c228771d9f30ca8cd8d2 Mon Sep 17 00:00:00 2001 From: Nishant Kaushal <101548649+nishant0708@users.noreply.github.com> Date: Sun, 21 Jul 2024 01:21:53 +0530 Subject: [PATCH] fixed --- src/components/PForm.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/components/PForm.js b/src/components/PForm.js index e4c6f7f..d10aa2b 100644 --- a/src/components/PForm.js +++ b/src/components/PForm.js @@ -42,12 +42,12 @@ const PForm = () => { const expiryDate = new Date(expiry_date); const diffDays = (expiryDate - mfdDate) / (1000 * 60 * 60 * 24); - let notifyDays; - if (diffDays > 3) { - notifyDays = 3; - } else { - notifyDays = 1; - } + let notifyDays =diffDays; + // if (diffDays > 3) { + // notifyDays = 3; + // } else { + // notifyDays = 1; + // } if (!notificationTimeout) { alert(`Set notification for ${notifyDays} days`); @@ -85,12 +85,13 @@ const PForm = () => { const expiryDate = new Date(expiry_date); const diffDays = (expiryDate - mfdDate) / (1000 * 60 * 60 * 24); - let notifyDays; - if (diffDays > 3) { - notifyDays = 5; - } else { - notifyDays = 1; - } + let notifyDays=diffDays ; + + // if (diffDays > 3) { + // notifyDays = 5; + // } else { + // notifyDays = 1; + // } const productDataWithNotification = { ...formattedProductData, @@ -103,7 +104,7 @@ const PForm = () => { "Manufacturing date cannot be greater than or equal to expiry date." ); } - + console.log("diff",diffDays); try { const token = localStorage.getItem("token");