From 907c4dc7ba114babc4a53b4d680d71a6f7e6382e Mon Sep 17 00:00:00 2001 From: Michael Bigelow Date: Mon, 20 Apr 2020 19:33:03 -0400 Subject: [PATCH] fix: AttributeError in Fyyur starter code If the locale argument is not specified when calling babel.dates.format_datetime(), it throws the following error: AttributeError: 'NoneType' object has no attribute 'days' --- projects/01_fyyur/starter_code/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/01_fyyur/starter_code/app.py b/projects/01_fyyur/starter_code/app.py index b30c04a42a2..7b2192ac3ee 100644 --- a/projects/01_fyyur/starter_code/app.py +++ b/projects/01_fyyur/starter_code/app.py @@ -67,7 +67,7 @@ def format_datetime(value, format='medium'): format="EEEE MMMM, d, y 'at' h:mma" elif format == 'medium': format="EE MM, dd, y h:mma" - return babel.dates.format_datetime(date, format) + return babel.dates.format_datetime(date, format, locale='en') app.jinja_env.filters['datetime'] = format_datetime