I'm making a wrapper on top of TelerikDatePicker and this is how my component is working
<TelerikDatePicker T="TDate"
Value="@_value"
ValueChanged="@ValueChanged"
ValueExpression="@ValueExpression"
Enabled="@Enabled"
Class="@ClassMapper.AsString()"
Format="@Format" />
@code {
// ... the other properties
[Parameter]
public virtual string Format { get; set; }
}
But here is the problem. This component will give me the error
Error: System.AggregateException: One or more errors occurred. (Value cannot be null. (Parameter 'input'))
---> System.ArgumentNullException: Value cannot be null. (Parameter 'input')
at System.Text.RegularExpressions.Regex.Replace(String input, String replacement)
at System.Text.RegularExpressions.Regex.Replace(String input, String pattern, String replacement)
at Telerik.Blazor.Common.DateHelpers.FormatHelper.ExpandFormat(String format)
at Telerik.Blazor.Common.DateHelpers.FormatHelper.ConvertToKendoIntl(String format)
at Telerik.Blazor.Components.TelerikDateInputBase`1.GetDateInputOptions()
at Telerik.Blazor.Components.TelerikDateInputBase`1.OnAfterRenderAsync(Boolean firstRender)
So another solution would be set it to string.Empty, but than it will have a different result when I don't pass the Format property.
Here are the cases:
[Parameter]
public virtual string Format { get; set; } // gives the error
[Parameter]
public virtual string Format { get; set; } = ""; // doesn't give the default result
I had to make a walkaround to not pass Format to the component for it to work
@if (!string.IsNullOrEmpty(Format))
{
<TelerikDatePicker T="TDate"
Value="@_value"
ValueChanged="@ValueChanged"
ValueExpression="@ValueExpression"
Enabled="@Enabled"
Class="@ClassMapper.AsString()"
Format="@Format" />
}
else
{
<TelerikDatePicker T="TDate"
Value="@_value"
ValueChanged="@ValueChanged"
ValueExpression="@ValueExpression"
Enabled="@Enabled"
Class="@ClassMapper.AsString()" />
}
What should I set as a default value to my wrapper's Format property so it doesn't give me the error and also get's the default value of Format?
Please don't say that I should keep the @if (!string.IsNullOrEmpty(Format)), it's so bad and I don't want to use telerik and still have to make walkarounds.
When using DatePicker with Globalization the message that indicates that the component has an invalid date is still visible even after providing a correct date.
I want to apply some custom CSS to hide the disabled dates. However, it appears that k-state-disabled class is not applied to all of them.
For example, if I set the Max parameter to October 15th 2021, the remaining dates of October have the k-state-disabled but the ones in November only have k-other-month class.
The same behavior occurs when I set the Min parameter - the dates from the previous month do not have k-state-disabled class.
===========
ADMIN EDIT
===========
Note: This bug also affects Calendar, DateRangePicker and DateTimePicker components.
As a workaround for the time being you might try another approach - all the disabled cells have aria-disabled = "true" attribute which you can use as a CSS selector to target the disabled cells:
<style>
[aria-disabled="true"] {
visibility: hidden;
}
</style>
<TelerikDatePicker @bind-Value="datePickerValue" Max="@MaxValue"></TelerikDatePicker>
@code {
DateTime datePickerValue { get; set; } = new DateTime(2021, 10, 1);
DateTime MaxValue { get; set; } = DateTime.Now;
}
When using a DateTime? for input and a specific format, for example yyyy-MM-dd. If you just want to change the month part and type 03 the focus shifts to the start of the input and the month part gets replaced by MM.
Reproduce:
https://blazorrepl.telerik.com/QGYFEfPU52ceM2wL03
Select the month part and type 03 for example. If using a non nullable DateTime, this does not happen.
DateInput shows minvalue by default when bound to a nullable DateTime with value null. While this might not be a bug, in almost all cases, it would be much better to have the default value set to DateTime.Now rather than DateTime.Min which seem to be the case today.
When testing your datepicker control in NVDA, there are a number of accessibility issues.
I am using the latest version of NVDA 2021.3.3 on Chrome Version 98.0.4758.82 (Official Build) (64-bit). I will note that Jaws and Chrome work properly regarding the dropdown issues, so it may be an NVDA thing, but maybe some research can be done to see if there are some different aria attributes that will work so that if functions properly with both screen readers. For example this Aria Best Practices Date Combo Box example at least reads where the user is with the arrow keys. https://www.w3.org/TR/wai-aria-practices-1.2/examples/combobox/combobox-datepicker.html It is not perfect, but it is better than not being read at all.
And even outside of the date dropdown stuff, the date input portion (#1) above is an issue across the board. I know that it is a design decision that you guys have made, and that you have provided documentation as to why and how to use it, but most users are going to type in the slashes of a date, and it's not reasonable to write up a half page of documentation within my app to let users know how to use the control. I can't even put a short label that says enter date without slashes, because under some circumstances a slash is necessary, so it becomes confusing to the user, and screen reader users will get lost if they make a mistake because they are not informed that they have just switched to a different section.
Thanks.
<Admin>
As a workaround, you can add the DebounceDelay parameter with a high number as in this REPL link.
</Admin>
DatePicker cursor not advancing after month input. The problem arises when dd/MMM/yyyy format is applied.
To reproduce the issue open this REPL example. Type any date in the second DatePicker. When inserting a month value the cursor is not moved to the year section.
After inserting a month the cursor should be moved to the year section. As when no format is applied (the first DatePicker)Currently, if the ReadOnly parameter value is set to 'true,' the user can modify the value of the DateInput by using the arrow keys.
Reproduction: https://blazorrepl.telerik.com/mxaiabvd178zy7p948
For some reason I'm unable to select the date 01/03/2000 when using the date picker to select the date. Only thing special about this date is its exactly 24 years ago today.
I was able to reproduce in repl. https://blazorrepl.telerik.com/QyYFkdbU34QbG0Te32
I also attached a video so you can review the steps followed and result.
When dragging the mouse to select the whole input value, only the first segment on the left remains selected after releasing the mouse. The issue is reproducible in the DatePicker demo once you select a date. Video: https://app.screencast.com/Eoa6Xj2MzfOPN.
The problem is only reproducible in Firefox, the whole input is properly selected in Chrome and Edge.
When you use the DisabledDates parameter of the picker and it is null, the component throws an error that it cannot Select from the IEnumerable:
<TelerikDatePicker @bind-Value="@theValue" DisabledDates="@DisabledDates" />
@code{
DateTime theValue { get; set; }
List<DateTime> DisabledDates { get; 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é