Time.zone.parse(_, options) => Time.zone.strptime(_, options)

This commit is contained in:
simon lehericey 2018-10-25 17:48:50 +02:00
parent f620e4aee2
commit 4b25d16f5a
3 changed files with 3 additions and 3 deletions

View file

@ -30,7 +30,7 @@ class Champs::DatetimeChamp < Champ
nil
end
elsif /^\d{2}\/\d{2}\/\d{4}\s\d{2}:\d{2}$/.match?(value) # old browsers can send with dd/mm/yyyy hh:mm format
self.value = Time.zone.parse(value, "%d/%m/%Y %H:%M").strftime("%Y-%m-%d %H:%M")
self.value = Time.zone.strptime(value, "%d/%m/%Y %H:%M").strftime("%Y-%m-%d %H:%M")
elsif !(/^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}$/.match?(value)) # a datetime not correctly formatted should not be stored
self.value = nil
end