Fix bug with format_date's use of key function