mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-12 11:55:24 +08:00
fix(module: date-picker): set default value on clear for not nullable datetime type (#1100)
This commit is contained in:
parent
dcbaecc919
commit
9d6f2a7dac
@ -174,7 +174,11 @@ namespace AntDesign
|
||||
public override void ClearValue(int index = 0)
|
||||
{
|
||||
_isSetPicker = false;
|
||||
CurrentValue = default;
|
||||
|
||||
if (!IsNullable && DefaultValue != null)
|
||||
CurrentValue = DefaultValue;
|
||||
else
|
||||
CurrentValue = default;
|
||||
Close();
|
||||
}
|
||||
|
||||
|
@ -207,8 +207,17 @@ namespace AntDesign
|
||||
_isSetPicker = false;
|
||||
|
||||
var array = CurrentValue as Array;
|
||||
array.SetValue(default, 0);
|
||||
array.SetValue(default, 1);
|
||||
if (!IsNullable && DefaultValue != null)
|
||||
{
|
||||
var defaults = DefaultValue as Array;
|
||||
array.SetValue(defaults.GetValue(0), 0);
|
||||
array.SetValue(defaults.GetValue(1), 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
array.SetValue(default, 0);
|
||||
array.SetValue(default, 1);
|
||||
}
|
||||
|
||||
(string first, string second) = DatePickerPlaceholder.GetRangePlaceHolderByType(_pickerStatus[0]._initPicker, Locale);
|
||||
_placeholders[0] = first;
|
||||
|
Loading…
Reference in New Issue
Block a user