Hello, I want to use the radzen datepicker component in my project. However, it turned out the datepicker does not update when I change the format of the year. Let's say I change the year 2025 to just 25 then the datepicker does not recognize it and thinks the value has not changed. Manually rerendering is not an option because it causes other problems.
<RadzenDatePicker Name="@(Name + "input" + GUID)"
Style=@($"{getTextStyle()}")
class="@(DatePickerDC.ButtonVisible ? "form-control qsc-textbox-input":"form-control qsc-textbox-input hide-calendar-icon")"
@bind-Value=@DisplayValue
Disabled="@ProtectedOnDisplay"
@onfocusin="setFocusToggler"
@onfocusout="setFocusToggler"
ShowCalendarWeek="@(DatePickerDC.ShowCalendarWeeks ? true : false)"
ShowSeconds=false
DateFormat="@RadzenDateFormat"
Culture="@(CALENDAR_ISO ? null : new System.Globalization.CultureInfo("en-US"))">
<RadzenButton Click=@(args =>
{
DisplayValue = DateTime.Now;
StateHasChanged();
}) Text="Heute" Style="width: 40%; display: inline-block;" class="rz-my-4" />
<RadzenButton Click=@(async args =>
{
DisplayValue = null;
StateHasChanged();
}) Text="Keines" Style="width: 40%; display: inline-block;" class="rz-my-4" />
public DateTime FieldValue
{
get
{
return DatePickerDC.Value;
}
set
{
DatePickerDC.Value = value;
}
}
public DateTime? DisplayValue
{
get
{
return FieldValue == nullDate ? null : FieldValue;
}
set
{
if (value == null)
{
FieldValue = nullDate;
}
else
{
var newVal = new DateTime(value.Value.Year, value.Value.Month, value.Value.Day);
FieldValue = newVal;
}
}
}