Fixed a bug in date formatting