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
15 lines
417 B
TypeScript
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]
|
|
}
|