feat: 03 => update expiration date handling to accept string format and improve validation

This commit is contained in:
puriphatt 2025-01-21 16:29:19 +07:00
parent 199a008095
commit 095f190f99
3 changed files with 9 additions and 9 deletions

View file

@ -511,7 +511,7 @@ export async function getAttachmentHead(api: AxiosInstance, url: string) {
if (res) return res.headers;
}
export function calculateDaysUntilExpire(expireDate: Date): number {
export function calculateDaysUntilExpire(expireDate: Date | string): number {
const today = new Date();
const expire = new Date(expireDate);
const diffInTime = expire.getTime() - today.getTime();