Skip to content
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: updated calcualtions for showSixWeeks #2562

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MaksymA26
Copy link

@MaksymA26 MaksymA26 commented Nov 29, 2024

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


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


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 ?

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.

1 participant