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 when :libelle_procedure
dossier.procedure.libelle dossier.procedure.libelle
when :date_de_decision 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 else
'--BALISE_NON_RECONNUE--' '--BALISE_NON_RECONNUE--'
end end

View file

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

View file

@ -84,7 +84,7 @@
%h4 Options avancées %h4 Options avancées
%label{ for: :auto_archive_on } Archivage automatique le %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) (à 00h00)
%p.help-block %p.help-block
%i.fa.fa-info-circle %i.fa.fa-info-circle

View file

@ -15,7 +15,7 @@
- unless admin.last_sign_in_at.nil? - 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")) = 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 %td
= admin.procedures.where(published: true).count = admin.procedures.where(published: true).count

View file

@ -24,7 +24,7 @@
.col-xs-8.entreprise-info= @facade.etablissement.naf .col-xs-8.entreprise-info= @facade.etablissement.naf
.row .row
.col-xs-4.entreprise-label Date de création : .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 .row
.col-xs-4.entreprise-label Effectif organisation : .col-xs-4.entreprise-label Effectif organisation :
.col-xs-8.entreprise-info= @facade.entreprise.effectif .col-xs-8.entreprise-info= @facade.entreprise.effectif

View file

@ -40,5 +40,5 @@
= link_to backoffice_dossier_path(dossier.id) do = link_to backoffice_dossier_path(dossier.id) do
.notification .notification
.dossier-index= "Dossier nº #{dossier.id}" .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 .count= dossier.unreaded_notifications.count

View file

@ -45,7 +45,7 @@
%i.fa.fa-bell-o %i.fa.fa-bell-o
- @facade.last_notifications.each do |notification| - @facade.last_notifications.each do |notification|
.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 } = render partial: "layouts/left_panels/type_notif_fa", locals: { notification: notification }
- if ['champs'].include?(notification.type_notif) - if ['champs'].include?(notification.type_notif)
- if notification.liste.size > 1 - if notification.liste.size > 1

View file

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

View file

@ -1,14 +1,15 @@
require 'spec_helper' require 'spec_helper'
describe CommentaireDecorator do 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 } let(:decorator) { commentaire.decorate }
describe 'created_at_fr' do describe 'created_at_fr' do
subject { decorator.created_at_fr } subject { decorator.created_at_fr }
context 'when created_at have a value' do 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 end
end end