Skip to content

MudDatePicker: Fix FixYear#12372

Merged
ScarletKuro merged 2 commits intodevfrom
fix_12368_fixyear
Jan 2, 2026
Merged

MudDatePicker: Fix FixYear#12372
ScarletKuro merged 2 commits intodevfrom
fix_12368_fixyear

Conversation

@ScarletKuro
Copy link
Member

@ScarletKuro ScarletKuro commented Jan 1, 2026

Fixes: #12368

The FixYear parameter was not being used when displaying the year header in month view or initializing the calendar, causing the picker to show the current year instead of the fixed year.

Changes:

  • GetCalendarYear(): Return FixYear.Value when set, before falling back to date-based calculation
  • GetCalendarStartOfMonth(): Include HighlightedDate in fallback chain (which respects FixYear during initialization)

Example:

<!-- Now correctly displays and constrains to year 1900 -->
<MudDatePicker FixYear="1900" />

The fix ensures that when FixYear is specified (past or future), the DatePicker consistently displays that year in the header and renders the correct month's days without hiding them incorrectly.

Checklist:

  • I've read the contribution guidelines
  • My code follows the style of this project
  • I've added or updated relevant unit tests

@ScarletKuro
Copy link
Member Author

@copilot I added tests for #12368 issue, the tests and reproduces the problem.
You should fix it in a way that the new tests DatePicker_FixYear_Past and DatePicker_FixYear_Future pass, also the whole tests suits should pass after your patch.

Copy link
Contributor

Copilot AI commented Jan 1, 2026

@ScarletKuro I've opened a new pull request, #12373, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: ScarletKuro <[email protected]>
@mudbot mudbot bot added the bug Unexpected behavior or functionality not working as intended label Jan 1, 2026
@ScarletKuro ScarletKuro requested review from Anu6is and versile2 January 1, 2026 11:01
@ScarletKuro
Copy link
Member Author

Huge bug, imo

@ScarletKuro ScarletKuro merged commit 02387d9 into dev Jan 2, 2026
7 of 8 checks passed
@ScarletKuro ScarletKuro deleted the fix_12368_fixyear branch January 2, 2026 01:06
@ScarletKuro
Copy link
Member Author

ScarletKuro commented Jan 2, 2026

Meh, this created a bug, that now when you go from january from 2027 to the december of 2026, it doesnt switch the year

upd: Oh wait, it suppose to stay with FixYear, i guess. But it's just weird that internally PickerMonth changes to previous year, while HighlightedDate is not. This is kind of poorly programmed.

This was referenced Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected behavior or functionality not working as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MudDatePicker: FixYear property shows incorrect year or empty calendar

2 participants