From e89d60785f6d815adbdaf11f803cff707b0c0358 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Mon, 12 Nov 2018 10:26:48 +0100 Subject: [PATCH] Fix dates on activities and experiments [SCI-2778] --- app/controllers/activities_controller.rb | 6 ++++-- app/views/projects/show/_experiment.html.erb | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb index 54b693aae..0c443a3f3 100644 --- a/app/controllers/activities_controller.rb +++ b/app/controllers/activities_controller.rb @@ -34,12 +34,14 @@ class ActivitiesController < ApplicationController end # send last activity date of the previus batch previous_activity = Activity.find_by_id(params[:last_activity]) - previus_date = previous_activity.created_at if previous_activity + if previous_activity&.created_at + previus_date = I18n.l(previous_activity.created_at, format: :full_date) + end { activities: activities, more_activities_url: more_url, page: page, - previous_activity_created_at: I18n.l(previus_date, format: :full_date) + previous_activity_created_at: previus_date } end end diff --git a/app/views/projects/show/_experiment.html.erb b/app/views/projects/show/_experiment.html.erb index 266a949ef..51dbc635b 100644 --- a/app/views/projects/show/_experiment.html.erb +++ b/app/views/projects/show/_experiment.html.erb @@ -41,7 +41,7 @@ <% end %> - <%= localize(experiment.created_at, format: t('time.formats.full_date')) %> - <%= localize(experiment.updated_at, format: t('time.formats.full_date')) %> + <%= l(experiment.created_at, format: :full_date) %> - <%= localize(experiment.updated_at, format: :full_date) %>
<% if experiment.description? %>