formatDate method moved to client