module Ecoportal module API class V2 class Page class Component class DateField < Page::Component passthrough :value passthrough :show_time, :today_button, :past_only passthrough :create_event, :remind_me_in passthrough :renews, :renews_every, :renews_unit, :renews_until ISO8601 = "%Y-%m-%dT%H:%M:00Z" # "%Y-%m-%dT%H:%M:00.00Z" def value=(val) doc["value"] = self.class.to_time(val).yield_self do |datetime| datetime = datetime.utc.strftime(ISO8601) if datetime datetime end end def value if val = doc["value"] (Time.parse(val) rescue nil).yield_self do |datetime| datetime.localtime if datetime end end end end end end end end end