lib/scrivito/date_attribute.rb in scrivito_sdk-0.66.0 vs lib/scrivito/date_attribute.rb in scrivito_sdk-0.70.0.rc1

- old
+ new

@@ -10,9 +10,17 @@ else raise "The value is not a valid ISO date time: #{iso_date_time.inspect}" end end + def self.parse_iso8601(iso8601_date_time) + return unless iso8601_date_time + + DateTime.iso8601(iso8601_date_time).in_time_zone + rescue ArgumentError + raise "The value is not a valid ISO 8601 date time: #{iso8601_date_time.inspect}" + end + def self.serialize(attribute_value) attribute_value = case attribute_value when Date then attribute_value.to_time when Time then attribute_value.to_time.utc end