Files
web/apps/scandic-web/utils/getTierStartDate.ts
Chuma Mcphoy (We Ahead) ac53f128af Merged in feat/LOY-423-Nights-Stayed-Progress-for-L6-Members (pull request #3360)
feat(LOY-423): Add progress bar for L6 members showing nights stayed

* feat(LOY-423): Add progress bar for L6 members showing nights stayed

* chore(LOY-423): shorten css selector


Approved-by: Matilda Landström
2025-12-17 10:45:30 +00:00

15 lines
417 B
TypeScript

/**
* Calculate the tier start date from the tier expiration date.
* The tier period is 1 year, so start date is expiration minus 1 year.
*/
export function getTierStartDate(
tierExpirationDate: string | null | undefined
): string | null {
if (!tierExpirationDate) return null
const date = new Date(tierExpirationDate)
date.setFullYear(date.getFullYear() - 1)
return date.toISOString().split("T")[0]
}