[PR #409] [MERGED] Add Minimum Date, Maximum Date, Initial Month/Year, and SameStyleForA… #2179

Closed
opened 2026-01-29 18:17:36 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/radzenhq/radzen-blazor/pull/409
Author: @andrewaggb
Created: 3/30/2022
Status: Merged
Merged: 4/19/2022
Merged by: @enchev

Base: masterHead: master


📝 Commits (3)

  • 800bd2d Add Minimum Date, Maximum Date, Initial Month/Year, and SameStyleForAllDays
  • 6b6fccd Rename DatePicker MinimumDate/MaximumDate Parameters to Min/Max. Rename InitialMonth to InitialViewDate. Remove new SameStyles Parameter and replace it with a new class rz-datepicker-other-month.
  • 137e0bd Merge remote-tracking branch 'upstream/master'

📊 Changes

4 files changed (+55 additions, -7 deletions)

View changed files

📝 Radzen.Blazor/RadzenDatePicker.razor (+1 -1)
📝 Radzen.Blazor/RadzenDatePicker.razor.cs (+26 -5)
📝 Radzen.Blazor/themes/components/blazor/_datepicker.scss (+4 -0)
📝 RadzenBlazorDemos/Pages/DatePickerPage.razor (+24 -1)

📄 Description

I added some functionality to the DatePicker.

I think it's straightforward and the changes seem quite safe to me. None of these are breaking changes and none are required. omitting them results in identical behavior to the current calendar.

New Parameters

InitialMonth. There wasn't a way to have the calendar load on a different month than DateTime.Today. This is a very simple change to let you pick some other time period so the initial popup doesn't have to be the current month. It was the reason I forked the project. My main use case is to select a future date at least a week away and no more than 3 months away. Near the end of the month that means no days are available in the current month so I'd rather the calendar started with next month.

MinimumDate and/or MaximumDate. Simple way using parameters to disable everything before and/or after a particular date (and handles the year drop down). You could accomplish the same thing a custom daterender function and setting the YearRange parameter but I think this is simple and intuitive and similar to other calendars.

SameStyleForAllDays. (Better name is welcome). Currently days belonging to a month other than the selected month are visible in the calendar but look disabled because the razor page is applying the class 'rz-state-disabled'. I understand the style choice but I don't want those days to look disabled if my daterender function says it isn't.

Notes:
One thing that's slightly different is the initial value of Disabled in DateRenderEventArgs could be True if a date is less than the minimum or greater than the maximum.
DateRender can still override it.
But if minimum and/or maximum dates are in use your daterender could look like this where you take the initial value into account.
void DateRender(DateRenderEventArgs args)
{
args.Disabled = args.Disabled || dates.Contains(args.Date);
}


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/radzenhq/radzen-blazor/pull/409 **Author:** [@andrewaggb](https://github.com/andrewaggb) **Created:** 3/30/2022 **Status:** ✅ Merged **Merged:** 4/19/2022 **Merged by:** [@enchev](https://github.com/enchev) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (3) - [`800bd2d`](https://github.com/radzenhq/radzen-blazor/commit/800bd2ddbdc92d3b9a2ff7b7050e7e4c55c4aaf5) Add Minimum Date, Maximum Date, Initial Month/Year, and SameStyleForAllDays - [`6b6fccd`](https://github.com/radzenhq/radzen-blazor/commit/6b6fccdc2ff113977e90b6e4aea9839e2858fa4a) Rename DatePicker MinimumDate/MaximumDate Parameters to Min/Max. Rename InitialMonth to InitialViewDate. Remove new SameStyles Parameter and replace it with a new class rz-datepicker-other-month. - [`137e0bd`](https://github.com/radzenhq/radzen-blazor/commit/137e0bd7c3486430894a489206099dedc01290a7) Merge remote-tracking branch 'upstream/master' ### 📊 Changes **4 files changed** (+55 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `Radzen.Blazor/RadzenDatePicker.razor` (+1 -1) 📝 `Radzen.Blazor/RadzenDatePicker.razor.cs` (+26 -5) 📝 `Radzen.Blazor/themes/components/blazor/_datepicker.scss` (+4 -0) 📝 `RadzenBlazorDemos/Pages/DatePickerPage.razor` (+24 -1) </details> ### 📄 Description I added some functionality to the DatePicker. I think it's straightforward and the changes seem quite safe to me. None of these are breaking changes and none are required. omitting them results in identical behavior to the current calendar. New Parameters InitialMonth. There wasn't a way to have the calendar load on a different month than DateTime.Today. This is a very simple change to let you pick some other time period so the initial popup doesn't have to be the current month. It was the reason I forked the project. My main use case is to select a future date at least a week away and no more than 3 months away. Near the end of the month that means no days are available in the current month so I'd rather the calendar started with next month. MinimumDate and/or MaximumDate. Simple way using parameters to disable everything before and/or after a particular date (and handles the year drop down). You could accomplish the same thing a custom daterender function and setting the YearRange parameter but I think this is simple and intuitive and similar to other calendars. SameStyleForAllDays. (Better name is welcome). Currently days belonging to a month other than the selected month are visible in the calendar but look disabled because the razor page is applying the class 'rz-state-disabled'. I understand the style choice but I don't want those days to look disabled if my daterender function says it isn't. Notes: One thing that's slightly different is the initial value of Disabled in DateRenderEventArgs could be True if a date is less than the minimum or greater than the maximum. DateRender can still override it. But if minimum and/or maximum dates are in use your daterender could look like this where you take the initial value into account. void DateRender(DateRenderEventArgs args) { args.Disabled = **args.Disabled** || dates.Contains(args.Date); } --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 18:17:36 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#2179