ndwarshuis / org-sql

SQL backend for Emacs Org-Mode
GNU General Public License v3.0
97 stars 9 forks source link

Timestamps as property values don't land in timestamps table #27

Open aviav opened 4 weeks ago

aviav commented 4 weeks ago

Another day, another feature I'd like to have: Timestamps can be used in/as property values, like in

* Example
:PROPERTIES:
:EXAMPLE_TIMESTAMP: [2024-08-14 Wed 07:15]
:END:

If I implement this, my first idea would be to, in addition to parsing the timestamp and adding it to the timestamps table, add a property_timestamps table, inspired by headline_properties, since this is how org-sql tracks one-to-many relationships from what I can tell.

As always, I'd appreciate thoughts on this.

As an aside, I found a Reddit post where somebody started to catalogue places where one can use timestamps in Org Mode, and what difference the place makes to how the timestamp is interpreted.

ndwarshuis commented 3 weeks ago

This should be easy. org-element stores all node property values as strings (even timestamps), so they will need to be parsed using org-ml-from-string or similar. Other than that org-element does care and shouldn't be affected by the caveats in the reddit thread so long as the property drawer is valid

aviav commented 3 weeks ago

Thanks for the info! I'll look into it as soon as I encounter this as an obstacle again. I think for the use case that I had in the beginning of the week, I made into sub-headlines what I had first set out to describe using timestamp properties, which is already well-supported by org-sql