I want the user to only be able to select times between, for example, 11AM and 1PM. Setting Min and Max does not limit that, I can select any time:
Selected time: @selectedTimeHi,
This behavior was originally reported over 5 years ago and has not received significant demand or follow-up from the community since then. Considering this and the availability of a workaround, we are unable to prioritize it over more impactful and widely requested improvements.
If this limitation is still affecting your scenario, please share additional context or use cases. This will help us better assess the severity and reconsider prioritization in the future.
Still, here is a possible solution with rectricting the hours input in code:
<p>Selected time: @selectedTime</p>
<TelerikDateTimePicker Value="@selectedTime"
ValueChanged="@((DateTime? v) => OnValueChanged(v))"
Format="dd MMM yyyy HH:mm"
Width="250px" />
@code {
DateTime? selectedTime = DateTime.Today.AddHours(11);
void OnValueChanged(DateTime? value)
{
if (value == null)
return;
var time = value.Value.TimeOfDay;
if (time < TimeSpan.FromHours(11))
{
selectedTime = value.Value.Date.AddHours(11);
}
else if (time > TimeSpan.FromHours(13))
{
selectedTime = value.Value.Date.AddHours(13);
}
else
{
selectedTime = value;
}
}Regards,
Petar Mladenov
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.