Repository: MudBlazor/MudBlazor (2026-03-01T19:22:12Z)

Issue:
DateRangeChanged event does not fire after clearing and reselecting the same date range
### Before reporting

- [x] I have searched the **existing issues** for this bug
- [x] I tried it in a **private/incognito** browser (to rule out caching)

### What went wrong?

1. The MudDateRangePicker component does not a vent for clearing text.
2. If you selected a date range and clear the date using clearable icon and select the same date range again it does not call any event.

### What did you expect?

Once the date range is cleared and even though the user selects the same date range again it should trigger the appropriate event in the component.

I have added a few code to explain the event not triggering.

### Reproduction link

https://try.mudblazor.com/snippet/ckwTYrlPHvZXARjR

### Reproduction steps

1. Select a date range. E.g., : Start date : July-01-2025 and the end date : July-10-2025.
2. Now the date will be displayed as [ 7/1/2025 --> 7/10/2025 ] in the text field of the date range picker.
3. With the date you can also see a X icon at the last of the text field of date range picker.
4. User will click on the X icon and the date range picker will clear the selected date in the text field.
5. But once the date is cleared no event is triggered. Only event triggered is the bind-DataRange which is not an event.
6. Now user will see a empty text field at the date range picker component.
7. User will again start selecting a date range. This time user will select the same date range he/she has selected.
8. E,g.,: Start date : July-01-2025 and the end date : July-10-2025, once the date range is selected and date picker is closed no event will be triggered from the component.

### Version (bug)

8.9.0

### Version (working)

_No response_

### Browsers showing this issue

Chrome

### Operating systems affected

Windows

### Blazor rendering mode

WASM

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct


Discussion:
Thank you for the excellent and detailed bug report. The reproduction link and clear steps are very helpful.

You've raised two distinct points here:

1.  **Bug:** The `DateRangeChanged` event does not fire when re-selecting the same date range after it has been cleared using the 'X' icon.
2.  **Enhancement Request:** The component lacks a specific `OnClear` event that would fire when the value is cleared.

Regarding the bug, my initial thought is that the component might be comparing the newly selected range against the value it had *before* it was cleared, rather than its current `null` state. When you clear the input, the bound `DateRange` property correctly becomes `null`. When you then re-select the original date range, the component should ideally see this as a change from `null` to a new `DateRange` object and fire the `DateRangeChanged` event. The behavior you've described suggests this transition isn't being detected as a change.

This seems like a valid issue. The maintainers will be able to provide a definitive analysis.

---
*This comment was automatically generated using AI. If you have any feedback or questions, please share it in a reply.*



Patch:
diff --git a/src/MudBlazor/Components/DatePicker/MudDateRangePicker.razor.cs b/src/MudBlazor/Components/DatePicker/MudDateRangePicker.razor.cs
index 53e63215d03c..e7cd37ab2371 100644
--- a/src/MudBlazor/Components/DatePicker/MudDateRangePicker.razor.cs
+++ b/src/MudBlazor/Components/DatePicker/MudDateRangePicker.razor.cs
@@ -179,7 +179,7 @@ private Range<string>? RangeText
 
                 Touched = true;
                 _rangeText = value;
-                SetDateRangeAsync(ParseDateRangeValue(value?.Start, value?.End), false).CatchAndLog();
+                SetDateRangeAsync(value is null ? null : ParseDateRangeValue(value.Start, value.End), false).CatchAndLog();
             }
         }
 
@@ -483,11 +483,11 @@ protected internal override async Task SubmitAsync()
 
         protected override Task ResetValueAsync() => ClearAsync();
 
-        public override Task ClearAsync(bool close = true)
+        public override async Task ClearAsync(bool close = true)
         {
-            DateRange = null;
+            await SetDateRangeAsync(null, true);
             _firstDate = _secondDate = null;
-            return base.ClearAsync(close);
+            await base.ClearAsync(close);
         }
 
         protected override string GetTitleDateString()


Test patch:
diff --git a/src/MudBlazor.UnitTests/Components/DateRangePickerTests.cs b/src/MudBlazor.UnitTests/Components/DateRangePickerTests.cs
index 8be99e88c519..ade1974b8494 100644
--- a/src/MudBlazor.UnitTests/Components/DateRangePickerTests.cs
+++ b/src/MudBlazor.UnitTests/Components/DateRangePickerTests.cs
@@ -503,9 +503,7 @@ public async Task SetRangeTextFunc_NullInputNoError()
                 parameters.Add(p => p.DateRange,
                     new DateRange(new DateTime(2020, 12, 26), null)));
             await comp.Find("input").ChangeAsync("");
-            comp.Instance.DateRange.End.Should().BeNull();
-            comp.Instance.DateRange.Start.Should().BeNull();
-
+            comp.Instance.DateRange.Should().BeNull();
         }
 
         [Test]
@@ -786,7 +784,7 @@ await comp.SetParametersAndRenderAsync(parameters => parameters
 
             await comp.Find("button").ClickAsync(); //clear the input
 
-            picker.DateRange.Should().Be(new DateRange(null, null));
+            picker.DateRange.Should().BeNull();
         }
 
         [Test]
@@ -1362,6 +1360,60 @@ public void DateRangePicker_CustomClearIcon_Should_BeRenderedInMarkup()
             comp.Markup.Should().Contain(comp.Instance.ClearIcon);
         }
 
+        [Test]
+        public async Task DateRangePicker_ClearAndReselectSameDateRange_ShouldFireDateRangeChanged()
+        {
+            var initialRange = new DateRange(new DateTime(2020, 10, 26), new DateTime(2020, 10, 29));
+            var changedRanges = new List<DateRange>();
+
+            var comp = Context.Render<MudDateRangePicker>(parameters => parameters
+                .Add(p => p.Clearable, true)
+                .Add(p => p.DateRange, initialRange)
+                .Add(p => p.DateRangeChanged, (DateRange range) => changedRanges.Add(range)));
+
+            var picker = comp.Instance;
+            picker.DateRange.Should().Be(initialRange);
+
+            // Clear the date range via the clearable X button
+            await comp.Find("button").ClickAsync();
+
+            // DateRangeChanged should fire on clear
+            changedRanges.Should().HaveCount(1);
+
+            // Reselect the exact same date range (simulating user reselecting after clearing)
+            await comp.SetParametersAndRenderAsync(parameters => parameters.Add(p => p.DateRange, initialRange));
+
+            // DateRangeChanged should fire again even when reselecting the same range after clearing
+            changedRanges.Should().HaveCount(2);
+        }
+
+        [Test]
+        public async Task DateRangePicker_ClearViaClearAsync_ShouldFireDateRangeChanged()
+        {
+            var initialRange = new DateRange(new DateTime(2020, 10, 26), new DateTime(2020, 10, 29));
+            var changedRanges = new List<DateRange>();
+
+            var comp = Context.Render<MudDateRangePicker>(parameters => parameters
+                .Add(p => p.Clearable, true)
+                .Add(p => p.DateRange, initialRange)
+                .Add(p => p.DateRangeChanged, (DateRange range) => changedRanges.Add(range)));
+
+            var picker = comp.Instance;
+            picker.DateRange.Should().Be(initialRange);
+
+            // Clear the date range via ClearAsync
+            await comp.InvokeAsync(() => picker.ClearAsync());
+
+            // DateRangeChanged should fire on clear
+            changedRanges.Should().HaveCount(1);
+
+            // Reselect the exact same date range after clearing via ClearAsync
+            await comp.SetParametersAndRenderAsync(parameters => parameters.Add(p => p.DateRange, initialRange));
+
+            // DateRangeChanged should fire again when reselecting the same range after clearing
+            changedRanges.Should().HaveCount(2);
+        }
+
         [Test]
         public async Task StaticReadOnly_ShouldNotChangeDateRange()
         {