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:
@@ -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,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user