Merged in fix/LOY-597-upcoming-today (pull request #3517)

fix(LOY-597): Display "Today" for upcoming stay today

* fix(LOY-597): Display "Today" for upcoming stay today


Approved-by: Anton Gunnarsson
This commit is contained in:
Matilda Landström
2026-01-30 08:03:28 +00:00
parent 5a90d454ce
commit 0919134f88
3 changed files with 13 additions and 1 deletions

View File

@@ -33,7 +33,6 @@
align-items: center; align-items: center;
} }
/* Styles for new empty upcoming stays design */
.emptyUpcomingStaysContainer { .emptyUpcomingStaysContainer {
display: flex; display: flex;
padding: var(--Space-x6); padding: var(--Space-x6);

View File

@@ -212,6 +212,12 @@ describe("getTimeAgoText", () => {
expect(result).toBe("") expect(result).toBe("")
}) })
it("should return Today for todays date", () => {
const todaysDate = dt().format("YYYY-MM-DD")
const result = getTimeAgoText(todaysDate, mockIntl)
expect(result).toBe("Today")
})
}) })
describe("boundary transitions", () => { describe("boundary transitions", () => {

View File

@@ -22,6 +22,13 @@ export function getTimeAgoText(checkoutDate: string, intl: IntlShape): string {
return "" return ""
} }
if (daysDiff === 0) {
return intl.formatMessage({
id: "nextStay.today",
defaultMessage: "Today",
})
}
if (daysDiff <= 30) { if (daysDiff <= 30) {
// 1-30 days // 1-30 days
return intl.formatMessage( return intl.formatMessage(