-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(CalendarDay): fix margin-bottom calculation wrong for calendar days #13271
base: main
Are you sure you want to change the base?
Conversation
Why was this PR closed? |
Because unit tests failed,I am afraid my changes might be incorrect .I will submit this PR after the unit tests pass. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13271 +/- ##
==========================================
+ Coverage 89.60% 89.66% +0.06%
==========================================
Files 257 257
Lines 7013 7018 +5
Branches 1736 1736
==========================================
+ Hits 6284 6293 +9
+ Misses 384 381 -3
+ Partials 345 344 -1 ☔ View full report in Codecov by Sentry. |
@inottn |
Of course, this is exactly what snapshot testing is for. |
LGTM. PRs are usually processed in batches on the weekends. Thank you for your contribution in advance. |
thx :D |
PR Description
This PR fixes an incorrect margin calculation logic in the CalendarDay component that determines the last row of days. The fix improves the accuracy of row position detection, particularly for edge cases like March 2025.
Issue
Description
When the calendar displays March 2025 in range selection mode, the second-to-last row has a
margin-bottom: 0
, causing inconsistent spacing between rows.Reproduction
https://codesandbox.io/p/github/phil668/vant-bug-reproduction/main?import=true
Expected Behavior
margin-bottom: 4
margin-bottom: 0
Current Behavior
margin-bottom: 0
Root Cause
The current logic uses
offset + date > 28
to determine if a day is in the last row, which proves inaccurate in certain scenarios. For example, in March 2025:6 + 23 > 28
evaluates to true