Skip to content

MudBaseDatePicker: Don't try to highlight invalid dates#10785

Merged
mikes-gh merged 3 commits intoMudBlazor:devfrom
Anu6is:BaseDatePicker-Fix-FailingTest
Feb 1, 2025
Merged

MudBaseDatePicker: Don't try to highlight invalid dates#10785
mikes-gh merged 3 commits intoMudBlazor:devfrom
Anu6is:BaseDatePicker-Fix-FailingTest

Conversation

@Anu6is
Copy link
Contributor

@Anu6is Anu6is commented Feb 1, 2025

Description

Highlighted date fails if an invalid fixed day is provided for the current month.

The unit test regarding this scenario was updated to consistently test an invalid fixed date for a predefined current day.
The test passed previously as it simply tested fixed date only, meaning it succeeded in months with 31 days.

How Has This Been Tested?

Unit tests

Type of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or improvement to the website or code docs)

Checklist

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

- update test to consistantly test scenario
@github-actions github-actions bot added bug Unexpected behavior or functionality not working as intended PR: needs review labels Feb 1, 2025
@codecov
Copy link

codecov bot commented Feb 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.85%. Comparing base (13a89f8) to head (524da4e).
Report is 2 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #10785      +/-   ##
==========================================
+ Coverage   91.83%   91.85%   +0.01%     
==========================================
  Files         427      427              
  Lines       13430    13431       +1     
  Branches     2592     2593       +1     
==========================================
+ Hits        12334    12337       +3     
  Misses        523      523              
+ Partials      573      571       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

var day = FixDay ?? 1;

HighlightedDate = new DateTime(year, month, day);
DateTime.TryParseExact($"{year}-{month}-{day}", "yyyy-M-d", Culture, DateTimeStyles.None, out var date);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (DateTime.TryParseExact($"{year}-{month}-{day}", "yyyy-M-d", Culture, DateTimeStyles.None, out var date))
{
    HighlightedDate = date
}

Might read a bit easier?

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 1, 2025

@mikes-gh mikes-gh merged commit 62d6c26 into MudBlazor:dev Feb 1, 2025
6 checks passed
@mikes-gh
Copy link
Contributor

mikes-gh commented Feb 1, 2025

Thanks . Nice use of FakeTimeProvider

@mikes-gh mikes-gh changed the title BaseDatePicker- Fix failing scenario MudBaseDateRangePicker: Dont try to highlight invalid dates Feb 1, 2025
@mikes-gh mikes-gh changed the title MudBaseDateRangePicker: Dont try to highlight invalid dates MudBaseDateRangePicker: Don't try to highlight invalid dates Feb 1, 2025
@mikes-gh mikes-gh changed the title MudBaseDateRangePicker: Don't try to highlight invalid dates MudBaseDatePicker: Don't try to highlight invalid dates Feb 1, 2025
@Anu6is Anu6is deleted the BaseDatePicker-Fix-FailingTest branch February 19, 2025 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected behavior or functionality not working as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants