<aside> 👉 Links (Property base class)
Notion Ruby Mapping Public API Reference
</aside>
<aside> 💡
[P] means methods for Page Property, [DB/DS] means methods for Database or DataSource Property.
</aside>
date of Page property returns a Hash object with start, end and time_zone keys.date of Database property returns an empty Hash {}.page.properties["DateTitle"].date
# => {"start"=>"2022-03-14", "end"=>nil, "time_zone"=>nil}
db.properties["DateTitle"].date
# => {}
end_date of Page property returns the end date or end date-time property value of the page.
end_date of Database property raises StandardError.
page.properties["DateTitle"].end_date
# => nil
db.properties["DateTitle"].end_date
# ...:in `assert_page_property': end_date= can execute only Page property. (StandardError)
clear of Page property clears the date value of the page property and sets will_update_flag to true.
Internally, clear is equivalent to setting start_date = nil.
clear returns self.
clear of Database property raises StandardError.
page.properties["DateTitle"].clear
# => #<NotionRubyMapping::DateProperty:...>
page.save
# Updates the page property with {"type"=>"date", "date"=>nil}
db.properties["DateTitle"].clear
# ...:in `assert_page_property': clear can execute only Page property. (StandardError)
nil to clear only the end date while keeping the start date.end_date=(value) of Page property sets the end date or end date-time property value of the page and set will_update_flag to true.
end_date = nil clears only the end date. If the start date exists, the date property itself remains.
end_date=(value) of Database property raises StandardError.
page.properties["DateTitle"].end_date = Date.new(2022, 5, 5)
# => #<Date: 2022-05-05 ((2459705j,0s,0n),+0s,2299161j)>
page.properties["DateTitle"].end_date = nil
# => nil
# The start date is kept, and only the end date is cleared.
db.properties["DateTitle"].end_date = Date.new(2022, 5, 5)
# ...:in `assert_page_property': end_date= can execute only Page property. (StandardError)