Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar: Year is not updated in calendar header when viewDate is changed #7306

Closed
angelina-chekanova opened this issue Oct 4, 2024 · 4 comments
Labels
Resolution: Duplicate Issue has already been reported or a pull request related to same issue has already been submitted
Milestone

Comments

@angelina-chekanova
Copy link

Describe the bug

I used the following code to set viewDate to today:

const [viewDate, setViewDate] = useState<Date>(new Date());

const handleDatesChange = (dates: Date[]) => {
  dates && dates.length && setViewDate(dates[0]);
};

const handleHide = () => {
  if (!dates || !dates.length) {
    setViewDate(new Date());
  }
};

Calendar:

<Calendar
    value={dates && dates.length ? dates[0] : null}
    viewDate={viewDate}
    onChange={(event) => handleDatesChange(event.value ? ([event.value] as [Date]) : [])}
    onHide={handleHide}
 />

Reproducer

No response

System Information

Primereact 10.7.0, react 17.0.2.

Steps to reproduce the behavior

  1. Select a date in a calendar with another year.
  2. Clear the date (remove in input field).
  3. Change focus.
  4. Return back to the calendar. Current month and date is shown - as expected. Wrong year in calendar header (the same as in the date, which was cleared, instead of current year).

Expected behavior

Current month, date and year is shown in calendar.

@angelina-chekanova angelina-chekanova added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Oct 4, 2024
@melloware
Copy link
Member

@KumJungMin i think you already fixed this it is just not released yet?

@melloware
Copy link
Member

Fixed for next release: #7254

@melloware melloware added Resolution: Duplicate Issue has already been reported or a pull request related to same issue has already been submitted and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Oct 4, 2024
@melloware melloware added this to the 10.8.4 milestone Oct 4, 2024
Copy link

github-actions bot commented Oct 4, 2024

This issue is a duplicate and has already been reported and possibly fixed. Please review other issues both open and closed for a similar issue to this one.

@melloware melloware closed this as not planned Won't fix, can't repro, duplicate, stale Oct 4, 2024
@KumJungMin
Copy link
Contributor

@melloware Oh! I appreciate you checking out the release! 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Duplicate Issue has already been reported or a pull request related to same issue has already been submitted
Projects
None yet
Development

No branches or pull requests

3 participants