From e5225afb05e7c351b0224241b17cd3edf723bec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AC=A8=E6=9C=A8=E5=A4=B4?= Date: Tue, 23 Mar 2021 11:08:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(module:=20rangepicker):=20[selected=20date?= =?UTF-8?q?=20on=20end=20picker]=E3=80=81[quarter=20panel's=20ranges]=20?= =?UTF-8?q?=20are=20incorrect=20(#1260)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(model: rangepicker): quarter panel's ranges are not correct * fix(module: rangepicker): selected date on end picker is incorrect --- .../date-picker/internal/DatePickerPanelBase.cs | 10 +++------- .../date-picker/internal/DatePickerTemplate.razor.cs | 11 ++++++----- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/components/date-picker/internal/DatePickerPanelBase.cs b/components/date-picker/internal/DatePickerPanelBase.cs index 1c43a045..90041bb8 100644 --- a/components/date-picker/internal/DatePickerPanelBase.cs +++ b/components/date-picker/internal/DatePickerPanelBase.cs @@ -176,7 +176,7 @@ namespace AntDesign int? second = null) { return DateHelper.CombineNewDate( - GetIndexPickerValue(0), + PickerValue, year, month, day, @@ -188,16 +188,12 @@ namespace AntDesign protected void ChangePickerYearValue(int interval) { - var currentValue = GetIndexPickerValue(0); - - ChangePickerValue(DateHelper.AddYearsSafely(currentValue, interval), null); + ChangePickerValue(DateHelper.AddYearsSafely(PickerValue, interval), null); } protected void ChangePickerMonthValue(int interval) { - var currentValue = GetIndexPickerValue(0); - - ChangePickerValue(DateHelper.AddMonthsSafely(currentValue, interval), null); + ChangePickerValue(DateHelper.AddMonthsSafely(PickerValue, interval), null); } protected void Close() diff --git a/components/date-picker/internal/DatePickerTemplate.razor.cs b/components/date-picker/internal/DatePickerTemplate.razor.cs index 93b0b8ce..169aa45e 100644 --- a/components/date-picker/internal/DatePickerTemplate.razor.cs +++ b/components/date-picker/internal/DatePickerTemplate.razor.cs @@ -134,7 +134,8 @@ namespace AntDesign.Internal private bool IsDateInRange(DateTime currentColDate) { - if (!IsRange || !Picker.IsIn(DatePickerType.Date, DatePickerType.Year, DatePickerType.Month)) + if (!IsRange || + !Picker.IsIn(DatePickerType.Date, DatePickerType.Year, DatePickerType.Month, DatePickerType.Quarter)) { return false; } @@ -209,7 +210,7 @@ namespace AntDesign.Internal private string GetRangeHoverCls(DateTime currentColDate) { if (!IsRange || DatePicker.HoverDateTime == null - || Picker.IsIn(DatePickerType.Date, DatePickerType.Year, DatePickerType.Month) == false) + || Picker.IsIn(DatePickerType.Date, DatePickerType.Year, DatePickerType.Month, DatePickerType.Quarter) == false) { return ""; } @@ -291,7 +292,7 @@ namespace AntDesign.Internal private string GetRangeStartCls(DateTime currentColDate) { - if (!IsRange || Picker.IsIn(DatePickerType.Date, DatePickerType.Year, DatePickerType.Month) == false) + if (!IsRange || Picker.IsIn(DatePickerType.Date, DatePickerType.Year, DatePickerType.Month, DatePickerType.Quarter) == false) { return ""; } @@ -332,7 +333,7 @@ namespace AntDesign.Internal private string GetRangeEndCls(DateTime currentColDate) { - if (!IsRange || Picker.IsIn(DatePickerType.Date, DatePickerType.Year, DatePickerType.Month) == false) + if (!IsRange || Picker.IsIn(DatePickerType.Date, DatePickerType.Year, DatePickerType.Month, DatePickerType.Quarter) == false) { return ""; } @@ -374,7 +375,7 @@ namespace AntDesign.Internal private string GetRangeEdgeCls(DateTime currentColDate) { - if (!IsRange || Picker.IsIn(DatePickerType.Date, DatePickerType.Year, DatePickerType.Month) == false) + if (!IsRange || Picker.IsIn(DatePickerType.Date, DatePickerType.Year, DatePickerType.Month, DatePickerType.Quarter) == false) { return ""; }