Skip to content

Duplicate today classes when calendar is pre-rendered with Next.js 15 #2768

Open
@franciscolourenco

Description

@franciscolourenco

When using RDP with Next.js 15, the page is pre-rendered at build time, applying the "today" classname on the day of the build. After the calendar is loaded in the client, an additional "today" classname is applied on today's date. At this point, two "today" days are displaying in the calendar.

Switching between months corrects the problem, but until then, two "today" dates are displayed.

To reproduce

'use client'

import { DayPicker } from "react-day-picker";
import "react-day-picker/style.css";

export default function App() {
  return <DayPicker mode="single" />;
}

Actual Behavior

The day in which the app was built is incorrectly displayed as today, alongside today's date.

Expected Behavior

The day in which the app was built should loose the classnames when the calendar is mounted on the client.

Screenshots

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions