> For the complete documentation index, see [llms.txt](https://help.pixfizz.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.pixfizz.com/products-and-design/how-to-create-templates/calendar-setup/calendar-week-starting-with-sunday.md).

# Calendar Week Starting with Sunday

```xml
<dates name="calendar-month">
    <dateshift day="-6">
        <defdate weekday="SU" name="sunday-of-first-week"/>
    </dateshift>
    <dateshift to="sunday-of-first-week">
        <!-- generate 6 weeks of dates (6 * 7 = 42) -->
        <dategen freq="daily" count="42" />
    </dateshift>
    
    <!-- Shift back one day to get the last day of previous month and store it. -->
    <defdate day="-1" name="last-day-of-previous-month"/>
    <!-- Store the last generated date from the main sequence. -->
    <dateshift to="sunday-of-first-week">
        <defdate day="+41" name="last-generated-date"/>
    </dateshift>
    
    <!-- Mark all dates up to the last day of previous month for deletion. -->
    <dateshift to="sunday-of-first-week">
        <dategen freq="daily" until="last-day-of-previous-month" tag="out-of-range"/>
    </dateshift>
    <!-- Mark all dates from next month for deletion. -->
    <!-- We start with first day of main month again, then shift to first day of next month. -->
    <dateshift month="+1">
        <dategen freq="daily" until="last-generated-date" tag="out-of-range"/>
    </dateshift>
</dates>
```
