Skip to content

fix: updated calcualtions for showSixWeeks#2562

Open
MaksymA26 wants to merge 1 commit intowix:masterfrom
MaksymA26:master
Open

fix: updated calcualtions for showSixWeeks#2562
MaksymA26 wants to merge 1 commit intowix:masterfrom
MaksymA26:master

Conversation

@MaksymA26
Copy link

@MaksymA26 MaksymA26 commented Nov 29, 2024

fixes: #2395
fixes: #1829

const calculateDays = (dates: XDate[], from: XDate, to: XDate) => {
let before: XDate[] = [];
let after: XDate[] = [];
const days = dates.map(day => day.clone());
Copy link
Author

Choose a reason for hiding this comment

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

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) {
Copy link
Author

Choose a reason for hiding this comment

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

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) {
Copy link
Author

@MaksymA26 MaksymA26 Nov 29, 2024

Choose a reason for hiding this comment

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

42 = 6weeks * 7days
Should I move it to variable or you can understand from the context what it is ?

@MaksymA26
Copy link
Author

MaksymA26 commented Feb 9, 2025

@Inbal-Tish Hi, could you please take a look at this PR (:

@NiharR27
Copy link

+1, not sure why this is getting ignored :(

@himitu-da
Copy link

Hi, I just encountered the same issue with February 2026 (only showing 5 weeks).

@sifthedog
Copy link

I'd love to have this PR merged. Let me know if any help is needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ShowSixWeeks not work for Feb 2026 Incompatibility between showSixWeeks and firstDay

4 participants