From 0f6aa7786fc0cd62e1df402d7a68d3b35fc07a82 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Wed, 16 Jul 2025 16:22:00 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=20MinValue=20=E5=80=BC=E5=AF=BC=E6=B8=85=E7=A9=BA=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E4=B8=8D=E5=B7=A5=E4=BD=9C=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/DateTimePicker/DateTimePicker.razor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Components/DateTimePicker/DateTimePicker.razor.cs b/src/BootstrapBlazor/Components/DateTimePicker/DateTimePicker.razor.cs index cea7a398424..6c33c822087 100644 --- a/src/BootstrapBlazor/Components/DateTimePicker/DateTimePicker.razor.cs +++ b/src/BootstrapBlazor/Components/DateTimePicker/DateTimePicker.razor.cs @@ -303,7 +303,7 @@ protected override void OnParametersSet() } else { - SelectedValue = Value == null ? DateTime.MinValue : (DateTime)(object)Value; + SelectedValue = Value == null ? (MinValue ?? DateTime.MinValue) : (DateTime)(object)Value; } if (MinValue > SelectedValue) From 0585f085755cf5b3339941c5f473673da0afd66b Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Wed, 16 Jul 2025 16:22:07 +0800 Subject: [PATCH 2/3] =?UTF-8?q?test:=20=E6=9B=B4=E6=96=B0=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UnitTest/Components/DateTimePickerTest.cs | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/test/UnitTest/Components/DateTimePickerTest.cs b/test/UnitTest/Components/DateTimePickerTest.cs index 4bf31c1d247..8cb7b56ba3f 100644 --- a/test/UnitTest/Components/DateTimePickerTest.cs +++ b/test/UnitTest/Components/DateTimePickerTest.cs @@ -132,7 +132,7 @@ public void DisplayMinValueAsEmpty_NullableDateTimeOffset() } [Fact] - public void OnClear_Ok() + public async Task OnClear_Ok() { var cut = Context.RenderComponent>(pb => { @@ -143,14 +143,14 @@ public void OnClear_Ok() // 点击 0001-01-01 单元格 var cell = cut.Find(".current .cell"); - cut.InvokeAsync(() => cell.Click()); + await cut.InvokeAsync(() => cell.Click()); // 文本框内容 var input = cut.Find(".datetime-picker-input"); Assert.Equal($"{DateTime.MinValue:yyyy-MM-dd}", input.GetAttribute("value")); // 点击清空按钮 var clear = cut.Find(".picker-panel-footer button"); - cut.InvokeAsync(() => clear.Click()); + await cut.InvokeAsync(() => clear.Click()); // 文本框内容 为 "" input = cut.Find(".datetime-picker-input"); @@ -162,7 +162,7 @@ public void OnClear_Ok() pb.Add(a => a.DisplayMinValueAsEmpty, true); }); cell = cut.Find(".current .cell"); - cut.InvokeAsync(() => cell.Click()); + await cut.InvokeAsync(() => cell.Click()); // 文本框内容 input = cut.Find(".datetime-picker-input"); @@ -170,11 +170,20 @@ public void OnClear_Ok() // 点击清空按钮 clear = cut.Find(".picker-panel-footer button"); - cut.InvokeAsync(() => clear.Click()); + await cut.InvokeAsync(() => clear.Click()); // 文本框内容 为 "" input = cut.Find(".datetime-picker-input"); Assert.Equal("", input.GetAttribute("value")); + + // 设置最小时间值 + cut.SetParametersAndRender(pb => + { + pb.Add(a => a.MinValue, DateTime.Today); + pb.Add(a => a.Value, null); + }); + clear = cut.Find(".picker-panel-footer button"); + await cut.InvokeAsync(() => clear.Click()); } [Fact] @@ -249,7 +258,10 @@ public void MaxValue_Ok() [Fact] public void MinValue_Ok() { - var cut = Context.RenderComponent>(builder => builder.Add(a => a.MinValue, DateTime.Today.AddDays(-1))); + var cut = Context.RenderComponent>(builder => + { + builder.Add(a => a.MinValue, DateTime.Today.AddDays(-1)); + }); cut.SetParametersAndRender(pb => { From 408bfdc83b35719d2921a537c07f61c842e03395 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Wed, 16 Jul 2025 16:22:18 +0800 Subject: [PATCH 3/3] chore: bump version 9.8.2-beta01 --- src/BootstrapBlazor/BootstrapBlazor.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index 09d572d9971..d50fa55ed68 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@  - 9.8.1 + 9.8.2-beta01