Skip to content

Commit e5a43ef

Browse files
committed
DatePicker will not display value initially when set to midnight
1 parent 4d9a9c9 commit e5a43ef

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Radzen.Blazor/RadzenDatePicker.razor.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,22 +457,24 @@ public object Value
457457
{
458458
if (value is DateTime dateTime && dateTime != default(DateTime))
459459
{
460-
DateTimeValue = DateTime.SpecifyKind(dateTime, Kind);
460+
_dateTimeValue = DateTime.SpecifyKind(dateTime, Kind);
461461
}
462462
#if NET6_0_OR_GREATER
463463
else if (value is DateOnly dateOnly)
464464
{
465-
DateTimeValue = dateOnly.ToDateTime(System.TimeOnly.MinValue, Kind);
465+
_dateTimeValue = dateOnly.ToDateTime(System.TimeOnly.MinValue, Kind);
466466
}
467467
else if (value is TimeOnly timeOnly)
468468
{
469-
DateTimeValue = new DateTime(1,1,0001, timeOnly.Hour, timeOnly.Minute, timeOnly.Second, timeOnly.Millisecond, Kind);
469+
_dateTimeValue = new DateTime(CurrentDate.Year, CurrentDate.Month, CurrentDate.Day, timeOnly.Hour, timeOnly.Minute, timeOnly.Second, timeOnly.Millisecond, Kind);
470470
}
471471
#endif
472472
else
473473
{
474-
DateTimeValue = null;
474+
_dateTimeValue = null;
475475
}
476+
477+
_value = ConvertToTValue(_dateTimeValue);
476478
}
477479
}
478480
}

0 commit comments

Comments
 (0)