[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Testing if a scheduled date is prior to another date
From: |
Tim Landscheidt |
Subject: |
Testing if a scheduled date is prior to another date |
Date: |
Sun, 22 Aug 2021 13:26:18 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
Hi,
in a capture template, I want to test whether the scheduled
date for a specific task is prior to another, calculated
date (and depending on the answer, insert a checkbox or
not).
I can get the scheduled date for the task by:
| (with-current-buffer (find-file-noselect "/path/to/file.org")
| (save-mark-and-excursion
| (goto-char
| (org-find-entry-with-id "TASK_ID"))
| (org-element-property ':scheduled (org-element-at-point))))
which returns a structure like:
| (timestamp
| (:type active
| :raw-value "<2021-08-30 Mo 08:00 .+4d>"
| :year-start 2021
| :month-start 8
| :day-start 30
| :hour-start 8
| :minute-start 0
| :year-end 2021
| :month-end 8
| :day-end 30
| :hour-end 8
| :minute-end 0
| :begin 436166
| :end 436192
| :post-blank 0
| :repeater-type restart
| :repeater-value 4
| :repeater-unit day))
However, comparing this value with org-time< & Co. is futile
as org-2ft always returns 0.
Before I wade through the various functions to build a con-
version chain, what is the best practice to compare time-
stamp values with dates? (And if there is an org-mode func-
tion that checks if the task at point is scheduled prior to
another date, I'd appreciate pointers as well :-).)
TIA,
Tim
- Testing if a scheduled date is prior to another date,
Tim Landscheidt <=