Calendar Week Starting with Monday

<dates name="calendar-month">
    <defdate weekday="MO" name="monday-of-first-week"/>
    <dateshift to="monday-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="monday-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="monday-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>

Last updated