Scrunitized calendar algorithms to fully support the range of year 1 to year 9999

Signed-off-by: Frank Mertens <frank@cyblogic.de>