From e40a30f477f0795efd8abb23ffe8906a4d5c8ec8 Mon Sep 17 00:00:00 2001 From: Syphax bouazzouni Date: Sun, 26 Nov 2023 07:45:52 +0100 Subject: [PATCH] fix date list properties population helper --- helpers/application_helper.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/helpers/application_helper.rb b/helpers/application_helper.rb index 172170fa..e8e1f3ee 100644 --- a/helpers/application_helper.rb +++ b/helpers/application_helper.rb @@ -88,7 +88,10 @@ def populate_from_params(obj, params) value = retrieved_values elsif attribute_settings && attribute_settings[:enforce] && attribute_settings[:enforce].include?(:date_time) # TODO: Remove this awful hack when obj.class.model_settings[:range][attribute] contains DateTime class - value = DateTime.parse(value) + is_array = value.is_a?(Array) + value = value.map{ |v| DateTime.parse(v) } + value = value.first unless is_array + value elsif attribute_settings && attribute_settings[:enforce] && attribute_settings[:enforce].include?(:uri) && attribute_settings[:enforce].include?(:list) # in case its a list of URI, convert all value to IRI value = value.map { |v| RDF::IRI.new(v) }