fix formatDate method