Template:Weekday in month/calc

This subtemplate calculates the day of the month of the nth (or −nth last) w-day in the month m.