format_date added
Refactored format_date to a cleaner code, using app.template_filter instead