From 163ad52285a9953676cd8ddf0b60e129d3c0e51b Mon Sep 17 00:00:00 2001 From: "kasia.oczkowska" Date: Wed, 30 Oct 2024 10:35:55 +0000 Subject: [PATCH] feat: check if cancellationEffectiveDateObject is a valid date --- .../SubscriptionCancelledAlert/index.ee.jsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/web/src/components/SubscriptionCancelledAlert/index.ee.jsx b/packages/web/src/components/SubscriptionCancelledAlert/index.ee.jsx index b36b1ffc..ca3acb4c 100644 --- a/packages/web/src/components/SubscriptionCancelledAlert/index.ee.jsx +++ b/packages/web/src/components/SubscriptionCancelledAlert/index.ee.jsx @@ -11,14 +11,17 @@ export default function SubscriptionCancelledAlert() { const formatMessage = useFormatMessage(); const subscription = useSubscription(); const trial = useUserTrial(); - - if (subscription?.data?.status === 'active' || trial.hasTrial) - return ; - const cancellationEffectiveDateObject = DateTime.fromISO( subscription?.data?.cancellationEffectiveDate, ); + if ( + subscription?.data?.status === 'active' || + trial.hasTrial || + !cancellationEffectiveDateObject.isValid + ) + return ; + return (