Refactored day mask usage.

This exposed an off-by-one error in `print.c#main`. That bug is also fixed.
Added missing documentation for the new day mask functions.