DatePicker default value


Was there a change recently to the DatePicker?

Before, if I wasn't setting an explicit value, the date shown would be empty, and when you click the calendar, it would default to the current year / month.

Now it defaults to 01/01/0001. My users have to select the current year, by scrolling through a long list.

To get around this, I had adjusted my program to set the default value to the current date in most instances. Not a major problem, but in some cases, I don't necessarily want to default to the current date.

Any way to default to an empty date, but if the user clicks the calendar, they see the current year / month?



I have noticed this too, however where I've previously used it, they show up correctly still. It seems to be only where I'm adding new ones, which doesn't make sense to me.

Can you explain how to set the default date manually?


You can set the default value in code. I often use a function to set first day of month, last day of month, or 15th day of month, etc. Below, for demonstration purposes, I'm just grabbing the current date. If there's a way to do it declaratively, perhaps RadZen can show us. (After letting us know if there's a way to leave it blank, of course ;).

<RadzenDatePicker Name="StartDate"
                  DateFormat="d" />

@code {

    DateTime start_date;

    protected override void OnInitialized()
        start_date = DateTime.Today;

1 Like


I have same problem as Mike after updating to the lastest version of Radzen (3.19.1). Datepicker fields show 01/01/0001 as default and when you click the calendar is not showing the current month and year as before.

Could you please help us?