Fix format_date method