Merge pull request #277 from sgmap/Fix_171_wrong_date

Fix #171 : add localtime to a bunch of date
This commit is contained in:
Mathieu Magnin 2017-05-11 18:07:27 +02:00 committed by GitHub
commit 05d7c96f5e
9 changed files with 11 additions and 9 deletions

View file

@ -85,7 +85,7 @@ module MailTemplateConcern
when :libelle_procedure
dossier.procedure.libelle
when :date_de_decision
dossier.processed_at.present? ? dossier.processed_at.strftime("%d/%m/%Y") : ""
dossier.processed_at.present? ? dossier.processed_at.localtime.strftime("%d/%m/%Y") : ""
else
'--BALISE_NON_RECONNUE--'
end

View file

@ -289,7 +289,7 @@ class Dossier < ActiveRecord::Base
else
parts = [
"Dossier déposé le ",
initiated_at.strftime("%d/%m/%Y"),
initiated_at.localtime.strftime("%d/%m/%Y"),
" sur la procédure ",
procedure.libelle,
" gérée par l'organisme ",

View file

@ -84,7 +84,7 @@
%h4 Options avancées
%label{ for: :auto_archive_on } Archivage automatique le
= f.text_field :auto_archive_on, id: 'auto_archive_on', value: @procedure.auto_archive_on.try{ |d| d.strftime("%d-%m-%Y") }, data: { provide: 'datepicker', 'date-language' => 'fr', 'date-format' => 'dd/mm/yyyy' }
= f.text_field :auto_archive_on, id: 'auto_archive_on', value: @procedure.auto_archive_on.try{ |d| d.localtime.strftime("%d-%m-%Y") }, data: { provide: 'datepicker', 'date-language' => 'fr', 'date-format' => 'dd/mm/yyyy' }
(à 00h00)
%p.help-block
%i.fa.fa-info-circle

View file

@ -15,7 +15,7 @@
- unless admin.last_sign_in_at.nil?
= time_ago_in_words(l(admin.last_sign_in_at, format: "%d/%m/%Y %H:%M UTC +02:00"))
(
= admin.last_sign_in_at.to_date.strftime('%d/%m/%Y')
= admin.last_sign_in_at.to_date.localtime.strftime('%d/%m/%Y')
)
%td
= admin.procedures.where(published: true).count

View file

@ -24,7 +24,7 @@
.col-xs-8.entreprise-info= @facade.etablissement.naf
.row
.col-xs-4.entreprise-label Date de création :
.col-xs-8.entreprise-info= Time.at(@facade.entreprise.date_creation).strftime "%d-%m-%Y"
.col-xs-8.entreprise-info= Time.at(@facade.entreprise.date_creation).localtime.strftime "%d-%m-%Y"
.row
.col-xs-4.entreprise-label Effectif organisation :
.col-xs-8.entreprise-info= @facade.entreprise.effectif

View file

@ -40,5 +40,5 @@
= link_to backoffice_dossier_path(dossier.id) do
.notification
.dossier-index= "Dossier nº #{dossier.id}"
.updated-at-index= dossier.first_unread_notification.created_at.strftime('%d/%m %H:%M')
.updated-at-index= dossier.first_unread_notification.created_at.localtime.strftime('%d/%m %H:%M')
.count= dossier.unreaded_notifications.count

View file

@ -45,7 +45,7 @@
%i.fa.fa-bell-o
- @facade.last_notifications.each do |notification|
.notification
.updated-at= notification.updated_at.strftime('%d/%m/%Y %H:%M')
.updated-at= notification.updated_at.localtime.strftime('%d/%m/%Y %H:%M')
= render partial: "layouts/left_panels/type_notif_fa", locals: { notification: notification }
- if ['champs'].include?(notification.type_notif)
- if notification.liste.size > 1

View file

@ -188,6 +188,7 @@ describe Backoffice::DossiersController, type: :controller do
end
it 'returns nothing' do
expect(assigns(:dossiers).count).to eq(0)
end
end

View file

@ -1,14 +1,15 @@
require 'spec_helper'
describe CommentaireDecorator do
let(:commentaire) { Timecop.freeze(Time.utc(2008, 9, 1, 10, 5, 0)) {create :commentaire} }
let(:time) { Time.utc(2008, 9, 1, 10, 5, 0) }
let(:commentaire) { Timecop.freeze(time) { create :commentaire } }
let(:decorator) { commentaire.decorate }
describe 'created_at_fr' do
subject { decorator.created_at_fr }
context 'when created_at have a value' do
it { is_expected.to eq '01/09/2008 - 10:05' }
it { is_expected.to eq time.localtime.strftime('%d/%m/%Y - %H:%M') }
end
end
end