From f249481495555164108a0e1fdcd4af0086d64727 Mon Sep 17 00:00:00 2001 From: Ankit Keshari Date: Wed, 2 Nov 2022 16:31:16 +0530 Subject: [PATCH] Fix the date issue on Create Access token Modal --- datahub-web-react/src/app/settings/utils.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/datahub-web-react/src/app/settings/utils.ts b/datahub-web-react/src/app/settings/utils.ts index 1fbadb33d04fd..a017f8ed6d3f1 100644 --- a/datahub-web-react/src/app/settings/utils.ts +++ b/datahub-web-react/src/app/settings/utils.ts @@ -24,12 +24,6 @@ const addDays = (days: number) => { return `The token will expire on ${result.toLocaleDateString()} at ${result.toLocaleTimeString()}.`; }; -const addMonths = (month: number) => { - const result = new Date(); - result.setMonth(result.getMonth() + month); - return `The token will expire on ${result.toLocaleDateString()} at ${result.toLocaleTimeString()}.`; -}; - export const getTokenExpireDate = (duration: AccessTokenDuration) => { switch (duration) { case AccessTokenDuration.OneHour: @@ -37,9 +31,9 @@ export const getTokenExpireDate = (duration: AccessTokenDuration) => { case AccessTokenDuration.OneDay: return addDays(1); case AccessTokenDuration.OneMonth: - return addMonths(1); + return addDays(30); case AccessTokenDuration.ThreeMonths: - return addMonths(3); + return addDays(90); case AccessTokenDuration.NoExpiry: return 'This token will never expire.'; default: