Define CAL_GREGORIAN if not defined. Closes #2633