Declined
Last Updated: 08 Jan 2021 12:52 by René
René
Created on: 08 Jan 2021 08:00
Category: DatePicker
Type: Bug Report
0
DatePicker Goto "Today" does not work if Min Parameter is set.

If I set a Min-Date like this:

<TelerikDatePicker @bind-Value="myDate"
                                    Format="dd.MM.yyyy"
                                    Min="@DateTime.Today.AddDays(1)">
 </TelerikDatePicker>

clicking on the "Today" link in the calendar does not do anything!

 

If I don't set Min then a click on "Today" correctly sets the current date.

Regards,

René

4 comments
René
Posted on: 08 Jan 2021 12:52

Hello Svetoslav,

this will indeed work for me. Thank's a lot !

Regards,

René

ADMIN
Svetoslav Dimitrov
Posted on: 08 Jan 2021 12:48

Hello Rene,

You could implement the desired behavior using Validation. Our online Validation demo for the DatePicker shows how to implement a custom data annotation attribute which might be useful for your application. 

Regards,
Svetoslav Dimitrov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

René
Posted on: 08 Jan 2021 09:47

Hello Svetoslav,

thank you for the quick reply. 
I guess my tired eyes missed the obvious - sorry for that.

I'm trying to achive that upon editing the user may only select a date at least one day in the future.  Problem is that the current value may be way in the past. Without being able to use the "today" link, the user has to manually forward to the current month before being able to pick a date.

Is there a way to open the datepicker in the current month or moving to the current month with one click with the current value being disabled for the datepicker?

Regards,

René

ADMIN
Svetoslav Dimitrov
Posted on: 08 Jan 2021 09:02

Hello Rene,

The reason why this is happening is that the Min parameter is set to one day after today. When you set the Min parameter it restricts selecting any date before it. If the parameter is set to 01/10/2021 (MM/dd/yyyy) the user would not be able to click on the Today link - 01/08/2021 (MM/dd/yyyy) because the earliest date he can select is 10th of January 2021. If you tweak this example to AddDays(-1) you would be able to use the Today link. 

Code snippet:

<TelerikDatePicker @bind-Value="@datePickerValue" 
                   Min="@DateTime.Today.AddDays(-1)">
</TelerikDatePicker>

@code  {
    DateTime datePickerValue { get; set; } = DateTime.Now;
}

That being said, I am marking this as declined because this is expected behavior for the component

Regards,
Svetoslav Dimitrov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.