Problem/Motivation

Selecting "Saturday" as the day to start the displayed week with leads to the current week displayed being basically one week off if the week date is before that day in the week.

The current implementation modifies the week start date in "build_table" with "{{ selected_day }} this week" which is potentially in the future.

Steps to reproduce

Select "Saturday" as the first day of the week in the views settings using the new "Calendar by week" display. Set the default value for the week date to "now".

Proposed resolution

I think something like the following is necessary to account for the current time being a somewhat conditional switch.

    if ($counter_date->format("w") != $selected_day) {
      $counter_date->modify('previous ' . $weekdays[$selected_day]);
    }

If my line of thinking is correct, I can provide a patch.

Comments

archnode created an issue. See original summary.

matthieuscarset’s picture

Status: Active » Postponed (maintainer needs more info)

Thank you very much for reporting this issue.

can you give me the week number/date where this is happening?

archnode’s picture

Status: Postponed (maintainer needs more info) » Active

With the default date set to 'now' this happens e.g. today: week 13, 27th march 2023 and displays the calendar default starting with 1st april 2023 to 7th april 2023.

Thank you for taking the time to respond. Please tell if you need anything else.

matthieuscarset’s picture

Status: Active » Needs review

I have reproduced the issue and it is (hopefully) fixed by the commit referenced above.

It's on 2.0.x dev branch only for now.

Looking forward to reading you.

attisan’s picture

Version: 2.0.7 » 2.0.x-dev
Status: Needs review » Needs work

@matthieuscarset your commit 46ed0545 actually breaks (forward) week navigation starting from the "current" week (I have weeks starting with Monday). With commit 46ed0545 included, all future weeks are off by one week.

lus’s picture

confirm what @attisan said, it breaks the navigation of the week view, needed to remove it from my project.

svendecabooter’s picture

StatusFileSize
new831 bytes

I can confirm this commit causes indeed an issue with moving forward in week view. My starting day is set to monday.
Since this is now in the 2.1.2 release, I am attaching a patch to remove this functionality from that release, in order not to break my installation.

Hopefully a solution for this issue can be provided that does not break the navigation as reported.

svendecabooter’s picture

Version: 2.0.x-dev » 2.1.x-dev

matthieuscarset’s picture

Status: Needs work » Needs review
StatusFileSize
new27.35 KB

Thank you all for reporting the issue and please forgive the inconvenience.

I think I might found the issue with the navigation by week when the first day of the week is saturday.

Here's a quickfix committed on 2.1.x for now.

Could you please test and let me know if it fix the situation?

I've tested myself and the pager by week of my calendar by week starting on Saturday works correctly (see attached screenshot).

Looking forward to hearing from you.

matthieuscarset’s picture

Status: Needs review » Fixed

Marking as fixed because of some testing done in direct messages on Slack.

Making a new release right now to unblock the situation for current users.

Feel free to comment and reopen if you still find an issue.

svendecabooter’s picture

Thanks for the quick fix

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.