Change admin announcement edition interface to use datetime-local (#18321)
* Change admin announcement edition interface to use datetime-local * Dynamically set announcement stop date as required if start date is set, set minimum date for stop date * Change `all_day` to not be bound to presence of time-range * Add pattern and placeholder as minimal fallback for browsers not supporting datetime-local * Display datetime-local inputs as local time Co-authored-by: Eugen Rochko <eugen@zeonfederated.com>
This commit is contained in:
@ -31,7 +31,6 @@ class Announcement < ApplicationRecord
|
||||
validates :starts_at, presence: true, if: -> { ends_at.present? }
|
||||
validates :ends_at, presence: true, if: -> { starts_at.present? }
|
||||
|
||||
before_validation :set_all_day
|
||||
before_validation :set_published, on: :create
|
||||
|
||||
def to_log_human_identifier
|
||||
@ -89,10 +88,6 @@ class Announcement < ApplicationRecord
|
||||
|
||||
private
|
||||
|
||||
def set_all_day
|
||||
self.all_day = false if starts_at.blank? || ends_at.blank?
|
||||
end
|
||||
|
||||
def set_published
|
||||
return unless scheduled_at.blank? || scheduled_at.past?
|
||||
|
||||
|
Reference in New Issue
Block a user