Problem/Motivation

When a custom "First day of week" is chosen, DateHelper::weekDaysOrdered() rekeys the result, so the 0th day corresponds to the first day.
This breaks expectations of projects like Calendar and Station module, who still internally consider Sunday the 0th day, and work with the "first day" setting.

Proposed resolution

Do not rekey when reordering.

Remaining tasks

N/A

User interface changes

N/A

API changes

Barely.

Data model changes

N/A

Important for RC: contributed project blocker. This code was moved into core for D8, and ideally should be correct.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tim.plunkett created an issue. See original summary.

tim.plunkett’s picture

alexpott’s picture

Version: 8.1.x-dev » 8.0.x-dev

Setting the correct version

tim.plunkett’s picture

Whoops, thanks. Reuploading to get the bot to run

dawehner’s picture

Looks great for me! In an ideal world, the helper would not be a static method, but we cannot change this anymore, I guess and its out of scope of this issue.

PS: Does someone mind to document that we need assertSame due to checking for the array order?

tim.plunkett’s picture

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Thank you!

tim.plunkett’s picture

xjm’s picture

Issue tags: -rc target triage +rc target

@effulgentsia and I agreed that this is definitely a valid RC target as a contrib blocker and non-disruptive bugfix.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 7: 2606934-datehelper-7.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Reviewed & tested by the community

Unrelated fail, the recent testrun passed.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs documentation

We should be documenting the expectation on the return value of DateHelper::weekDaysOrdered()

tim.plunkett’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs documentation
FileSize
4.21 KB
808 bytes
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 235472c and pushed to 8.0.x. Thanks!

  • alexpott committed de68e25 on 8.1.x
    Issue #2606934 by tim.plunkett: \Drupal\Core\Datetime\DateHelper::...

Status: Fixed » Closed (fixed)

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