Repository: ionic-team/ionic-framework
File: core/src/components/datetime/datetime.tsx (TypeScript)

Code before:

            if (!isCalDayDisabled && isDateEnabled !== undefined) {
              try {
                /**
                 * The `isDateEnabled` implementation is try-catch wrapped
                 * to prevent exceptions in the user's function from
                 * interrupting the calendar rendering.
                 */
                isCalDayDisabled = !isDateEnabled(dateIsoString);
              } catch (e) {
                printIonError(
                  'Exception thrown from provided `isDateEnabled` function. Please check your function and try again.',
                  e
                );
              }
            }

            let dateStyle: DatetimeHighlightStyle | undefined = undefined;

            /**
             * Custom highlight styles should not override the style for selected dates,
             * nor apply to "filler days" at the start of the grid.
             */
            if (highlightedDates !== undefined && !isActive && day !== null) {
              if (Array.isArray(highlightedDates)) {
                const matchingHighlight = highlightedDates.find((hd) => hd.date === dateIsoString);
                if (matchingHighlight) {
                  dateStyle = {
                    color: matchingHighlight.color,
                    backgroundColor: matchingHighlight.backgroundColor,
                  } as DatetimeHighlightStyle;
                }
              } else {
                /**
                 * Wrap in a try-catch to prevent exceptions in the user's function
                 * from interrupting the calendar's rendering.
                 */
                try {
                  dateStyle = highlightedDates(dateIsoString);
                } catch (e) {
                  printIonError(
                    'Exception thrown from provided `highlightedDates` callback. Please check your function and try again.',
                    e
                  );
                }
              }
            }

            return (
              <button
                tabindex="-1"

Review comment (suggestion):
We might want to consider removing time values from the ISO 8601 string. For example, this is a valid input for the `date` key: `2023-02-01T16:30`. However, we do a strict equality with the ISO 8601 string for just the date, so the example date I passed would never match anything.

Code after:
            if (!isCalDayDisabled && isDateEnabled !== undefined) {
              try {
                /**
                 * The `isDateEnabled` implementation is try-catch wrapped
                 * to prevent exceptions in the user's function from
                 * interrupting the calendar rendering.
                 */
                isCalDayDisabled = !isDateEnabled(dateIsoString);
              } catch (e) {
                printIonError(
                  'Exception thrown from provided `isDateEnabled` function. Please check your function and try again.',
                  el,
                  e
                );
              }
            }

            let dateStyle: DatetimeHighlightStyle | undefined = undefined;

            /**
             * Custom highlight styles should not override the style for selected dates,
             * nor apply to "filler days" at the start of the grid.
             */
            if (highlightedDates !== undefined && !isActive && day !== null) {
              dateStyle = getHighlightStyles(highlightedDates, dateIsoString, el);
            }

            return (
              <button
                tabindex="-1"
                data-day={day}
                data-month={month}
                data-year={year}
                data-index={index}
                data-day-of-week={dayOfWeek}
                disabled={isCalDayDisabled}
                class={{
                  'calendar-day-padding': day === null,
                  'calendar-day': true,
                  'calendar-day-active': isActive,
                  'calendar-day-today': isToday,
                }}
                style={
                  dateStyle && {
                    color: dateStyle.textColor,
                  }
                }
                aria-selected={ariaSelected}
                aria-label={ariaLabel}
                onClick={() => {
                  if (day === null) {