Conversation
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (66.66%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## dev #644 +/- ##
==========================================
+ Coverage 65.42% 65.48% +0.06%
==========================================
Files 111 111
Lines 8384 8385 +1
Branches 1480 1480
==========================================
+ Hits 5485 5491 +6
+ Misses 2391 2387 -4
+ Partials 508 507 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@mckaragoz Can you look at this please? |
|
This PR is not the ultimate solution. With this solution, we only hide the real value and show something else. And with this PR, the min value of types will be unusuable. I offer to add a new parameter like: And change the clear process: With this offered solution, you can easily set the date when user click on clear button. If no value set with parameter, it still goes to null for nullable types and min value for non nullable types. I think it's the best option, because you shouldn't set null value on non nullable types. Could you change your PR with this solution? |
Introduce a new parameter ValueOnClear (T?) on MudBaseDatePickerX to allow specifying the value applied when the clear button is used (defaults to default(T), null for nullable types). Update MudDateTimePicker.ClearAsync to call SetDateAsync(ToDateTime(ValueOnClear), true) instead of passing null, and change the close logic to honor the explicit close parameter (if AutoClose || close). This lets consumers control the cleared value and whether the picker closes when clearing.
Reset file
|
Looks good. Did you manually check the behavior also? |
|
@mckaragoz Can you check the changes please? |
|
I understand what you want to achieve. But it brings more problem. Non-nullable types can't be null. You hide the text on the component but the value still persists. So if user saves the cleared time, it sends 01/01/0001 to database, not null. It may cause data inconsistency. Normally we should use nullable types for better results. For non-nullable types we should find another solution like optional parameter etc. The value and text should always be the same. The component should only have one truth. |
The idea is "dynamic" default that can change with a parameter. So the component goes to a certain date when it reset or clear. With this way both developer and user can easily understand what is the true date for the component. |
This reverts commit 1ad8c46.
|
Nullable values clear to <MudDateTimePicker @bind-Value="_dateTime"
ValueOnClear="@DateTime.Now" />
<MudDateTimePicker @bind-Value="_dateTimeOffset"
ValueOnClear="@DateTimeOffset.Now" />
<MudDateTimePicker @bind-Value="_dateOnly"
ValueOnClear="@DateOnly.FromDateTime(DateTime.Now)" /> |
|
@mckaragoz I came up with another solution from a different perspective. |


Fix