Hi,
This is easily viewable in your demos. Using Safari, go to:
https://demos.telerik.com/blazor-ui/dateinput/overview
Try to use keyboard arrows left and right and up/down to change date. It doesn't hold the selected date part.
Works fine in Chrome / Firefox.
Create the WebAssembly CRUD example from the New Project Wizard and go to the Form page.
Type a year in the date picker. Do not remove the focus and type another year. After doing this a few times the input visibly lags and the form becomes slow.
---
ADMIN EDIT
A potential workaround could be to disable the pointer events so that the users will have a harder time focusing the input so they are more likely to use the drodown to choose dates:
.k-datepicker .k-dateinput input {
pointer-events: none;
}
<TelerikDatePicker Value="@person.StartDate"
OnChange="@( (object dt) => person.StartDate = (DateTime)dt )"
ValueExpression="@( () => person.StartDate )"
Width="100%" Id="StartDateDP">
</TelerikDatePicker>
---
My users want to paste dates in the date inputs (date pickers in our case). This seems to work in Kendo, but does not work in Blazor, even when the format of the copied data matches the Format of the component.
<p>
Try copying this date which is valid in the current format: 23/03/1998
<br />
then paste it in the date picker and see what happens to the <code>TheDate</code> field
</p>
@TheDate
<br />
<TelerikDateInput @bind-Value="TheDate" Format="dd/MM/yyyy" /> @TheDate.ToString("dd/MM/yyyy")
@code {
DateTime TheDate { get; set; } = new DateTime(2019, 11, 27, 02, 03, 44);
}
---
ADMIN EDIT
Allowing the paste into the DateInput (and by extension date picker,...) would have a lot of cases to control and that is why we have not yet enabled it. If the format is M/d/yyyy, for example, validation for numbers lower or equal to 12 would not be possible when the month is regarded. If the user pastes 8/2/2020 could mean two things - 8th of February 2020 or 2nd of August 2020. This might cause issues as the data that goes to the database might be incorrect and causing the application to misbehave.
That being said, how would you suggest handling the pasting of dates in the component. How would you like from us to handle the format difference of the dates? Please comment below.
---
See https://docs.telerik.com/blazor-ui/components/dateinput/supported-formats#two-digit-year-formats
I am using a 4-digit format as workaround, but 2-digit formats are quite normal over here. That is why most tools and OS-es have cutoff years. Often a floating cutoff year that is 50 years before the current date. So anything below 70 would be 20xx. Or you can have a cutoff year close to a century ago, because you consider dates past more relevant than future dates.Recreational steps:
1. Typed "05"
2. Typed "right arrow" (select month part)
3. Typed "03"
4. Typed "right arrow" (select year part)
5. Tried typing "2020"... but as you can see things went strangely.
Binding a date input or a date picker to a nullable value causes a build-time error
error CS1503: Argument 1: cannot convert from 'System.DateTime?' to 'System.DateTime'
Sample:
@using Telerik.Blazor.Components.Button