fix: updated calcualtions for showSixWeeks#2562
Conversation
| const calculateDays = (dates: XDate[], from: XDate, to: XDate) => { | ||
| let before: XDate[] = []; | ||
| let after: XDate[] = []; | ||
| const days = dates.map(day => day.clone()); |
There was a problem hiding this comment.
Added this to insure immutability, I'm not sure if this is indeed needed tho
| const daysForSixWeeks = daysOnPage / 7 >= 6; | ||
|
|
||
| if (showSixWeeks && !daysForSixWeeks) { | ||
| if (42 - daysOnPage > 7) { |
There was a problem hiding this comment.
for months with 28 days (5 weeks) (Feb 2026) => add 7 days before
Otherwise there's situation where 2 weeks from next month are displayed at the end and it just doesnt look right
If it bothers you we can just do to.addDays(42 - daysOnPage) but it's uglier in my opinion
| const daysForSixWeeks = daysOnPage / 7 >= 6; | ||
|
|
||
| if (showSixWeeks && !daysForSixWeeks) { | ||
| if (42 - daysOnPage > 7) { |
There was a problem hiding this comment.
42 = 6weeks * 7days
Should I move it to variable or you can understand from the context what it is ?
|
@Inbal-Tish Hi, could you please take a look at this PR (: |
|
+1, not sure why this is getting ignored :( |
|
Hi, I just encountered the same issue with February 2026 (only showing 5 weeks). |
|
I'd love to have this PR merged. Let me know if any help is needed |
fixes: #2395
fixes: #1829