From 55f2a7088284153e1465e7476641ba757078c779 Mon Sep 17 00:00:00 2001 From: balajis-qb Date: Tue, 17 Mar 2026 15:34:56 +0530 Subject: [PATCH 1/3] fix: Remove the redundant tooltip displayed on hovering the holiday - Removed holiday from title. - Retained holiday tooltip only in the hover tooltip. - Updated tests to reflect changes in title to tooltip text for better clarity. Closes #6260 --- src/day.tsx | 97 ++++++++++++++++++-------------------- src/test/day_test.test.tsx | 20 ++++---- 2 files changed, 57 insertions(+), 60 deletions(-) diff --git a/src/day.tsx b/src/day.tsx index 28a16c477..04c8c9a75 100644 --- a/src/day.tsx +++ b/src/day.tsx @@ -484,33 +484,27 @@ export default class Day extends Component { return `${prefix} ${formatDate(day, "PPPP", this.props.locale)}`; }; + getHolidayTitle = () => { + const { day, holidays } = this.props; + const compareDt = formatDate(day, "MM.dd.yyyy"); + return holidays?.has(compareDt) + ? holidays.get(compareDt)?.holidayNames.join(", ") + : ""; + }; + // A function to return the holiday's name as title's content getTitle = () => { - const { day, holidays = new Map(), excludeDates } = this.props; - const compareDt = formatDate(day, "MM.dd.yyyy"); - const titles = []; - if (holidays.has(compareDt)) { - titles.push(...holidays.get(compareDt).holidayNames); - } - if (this.isExcluded()) { - titles.push( - excludeDates - ?.filter((excludeDate) => { - if (excludeDate instanceof Date) { - return isSameDay(excludeDate, day); - } - return isSameDay(excludeDate?.date, day); - }) - .map((excludeDate) => { - if (excludeDate instanceof Date) { - return undefined; - } - return excludeDate?.message; - }), - ); - } - // I'm not sure that this is a right output, but all tests are green - return titles.join(", "); + const { day, excludeDates } = this.props; + + return this.isExcluded() + ? excludeDates + ?.flatMap((excludeDate) => + !(excludeDate instanceof Date) && isSameDay(excludeDate?.date, day) + ? excludeDate?.message + : [], + ) + .join(", ") + : ""; }; getTabIndex = () => { @@ -588,31 +582,32 @@ export default class Day extends Component { : getDate(this.props.day); }; - render = () => ( + render = () => { + const holidayTitle = this.getHolidayTitle(); // TODO: Use