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:
@@ -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);
|
||||||
|
|||||||
@@ -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", () => {
|
||||||
|
|||||||
@@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user