df(e) index for last day of the week is 0 instead of 7

The order of indices returned by df(e) is 1,2,3,4,5,6,0 instead of 1,2,3,4,5,6,7.

Minimal example of issue:

1. Set first day of the week in settings to whatever day tomorrow is (i.e. if today is Tuesday, set Wednesday as first day).

2. Create text item with $df(e)$ as formula.

3. Expected output: 7, actual output: 0

It seems to have been an issue before but was definitely fixed in between: