From 3768a497af857877ab5741c87115a44b50535a06 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Mon, 30 Jan 2023 14:25:43 +0100
Subject: [PATCH] Post date fix #773

---
 app/models/communication/website/post.rb                    | 2 +-
 app/views/admin/communication/websites/posts/_form.html.erb | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/models/communication/website/post.rb b/app/models/communication/website/post.rb
index e81056ab8..38a64202c 100644
--- a/app/models/communication/website/post.rb
+++ b/app/models/communication/website/post.rb
@@ -65,7 +65,7 @@ class Communication::Website::Post < ApplicationRecord
 
   validates :title, presence: true
 
-  before_validation :set_published_at, if: :published_changed?
+  before_validation :set_published_at
   after_save_commit :update_authors_statuses!, if: :saved_change_to_author_id?
 
   scope :published, -> {
diff --git a/app/views/admin/communication/websites/posts/_form.html.erb b/app/views/admin/communication/websites/posts/_form.html.erb
index c53bd9a58..fbdcea1d7 100644
--- a/app/views/admin/communication/websites/posts/_form.html.erb
+++ b/app/views/admin/communication/websites/posts/_form.html.erb
@@ -36,7 +36,7 @@
               <%= f.input :pinned %>
             </div>
           </div>
-          <%= f.input :published_at, html5: true %>
+          <%= f.input :published_at, html5: true, as: :date %>
         <% end %>
         <% if @website.languages.many? %>
           <%= f.input :language_id, collection: @website.languages, include_blank: false %>
-- 
GitLab