Fix date formatting issues

Fixes #942