finish activate warranty logic

Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
This commit is contained in:
Chloe
2024-06-26 09:44:58 +07:00
parent 2477fdf84e
commit d801de0cf1
13 changed files with 167 additions and 36 deletions

View File

@@ -19,7 +19,6 @@ export const validateEnvironmentVariables = () => {
'SHOPIFY_STOREFRONT_ACCESS_TOKEN',
'SHOPIFY_CUSTOMER_ACCOUNT_API_CLIENT_ID',
'SHOPIFY_CUSTOMER_ACCOUNT_API_URL',
'SHOPIFY_CUSTOMER_API_VERSION',
'SHOPIFY_ORIGIN_URL',
'SHOPIFY_ADMIN_API_ACCESS_TOKEN'
];
@@ -96,3 +95,14 @@ export function toPrintDate(date: string) {
day: 'numeric'
});
}
export const isBeforeToday = (date?: string | null) => {
if (!date) return false;
const today = new Date();
const compareDate = new Date(date);
today.setHours(0, 0, 0, 0);
compareDate.setHours(0, 0, 0, 0);
return compareDate <= today;
};