fix(module: date-picker): set default value on clear for not nullable datetime type (#1100)

This commit is contained in:
Andrzej Bakun 2021-02-05 15:18:40 +01:00 committed by GitHub
parent dcbaecc919
commit 9d6f2a7dac
2 changed files with 16 additions and 3 deletions

View File

@ -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();
}

View File

@ -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;