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
This commit is contained in:
14
apps/scandic-web/utils/getTierStartDate.ts
Normal file
14
apps/scandic-web/utils/getTierStartDate.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 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]
|
||||
}
|
||||
Reference in New Issue
Block a user