The script indicating the day of the week returns incorrect results for leap years.
The script lacks verification of leap years.
Something like that:
:local fully [:pick $date 7 11]
#is the year leap?
:if (($fully%4=0 and $fully%100!=0) or ($fully%400=0)) do={:set sum ($sum - 1)}