Merged in fix/add-years-to-get-days-until-text-util (pull request #3281)

fix: add years to getDaysUntilText + confirmation number in upcoming stay card

* fix: add years to getDaysUntilText + confirmation number in upcoming stay card


Approved-by: Erik Tiekstra
Approved-by: Matilda Landström
This commit is contained in:
Chuma Mcphoy (We Ahead)
2025-12-04 09:46:53 +00:00
parent aba7e7f9eb
commit 2738cbae7d
8 changed files with 88 additions and 11 deletions

View File

@@ -45,13 +45,28 @@ export function getDaysUntilText(
// Use proper month calculation for dates beyond 30 days
const monthsUntil = checkInDateTime.diff(now, "months")
if (monthsUntil <= 11) {
return intl.formatMessage(
{
id: "nextStay.inXMonths",
defaultMessage: "In {months, plural, one {# month} other { # months}}",
},
{
months: monthsUntil,
}
)
}
// 12+ months (show years)
const yearsUntil = checkInDateTime.diff(now, "years")
return intl.formatMessage(
{
id: "nextStay.inXMonths",
defaultMessage: "In {months, plural, one {# month} other { # months}}",
id: "nextStay.inXYears",
defaultMessage: "In {years, plural, one {# year} other {# years}}",
},
{
months: monthsUntil,
years: yearsUntil,
}
)
}