diff --git a/vedia.rb b/vedia.rb index ecba199..5002b33 100644 --- a/vedia.rb +++ b/vedia.rb @@ -510,7 +510,12 @@ helpers do end def format_date(timestamp) - "#{TZInfo::Timezone.get(session[:timezone]).to_local(timestamp).strftime('%F')}" + if session[:timezone] + "#{TZInfo::Timezone.get(session[:timezone]).to_local(timestamp).strftime('%F')}" + else + # Otherwise, format_date fails on first page after login. Not sure why... + "#{timestamp.strftime('%F')}" + end end def format_date_and_time(timestamp)