Calendar rebase (2)

This replaces #1316, but was itself replaced by #1371.