Depending on the locale of the server's operating system, the WEEK function used on a Sunday may return the next week, as Sunday is set as the first day of the week.
This can be tested with
which will return 1 on a German locale and 2 on a US locale.
In order to set Data Virtuality Server to the German locale, append the following line to standalone.conf.props.bat (Windows):
set "JAVA_OPTS=%JAVA_OPTS% -Duser.country=DE -Duser.language=de"
On UNIX systems, append the following line to standalone.conf.props:
JAVA_OPTS="$JAVA_OPTS -Duser.country=DE -Duser.language=de"