summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-01-09 10:37:10 +0200
committerThanos Apollo <[email protected]>2024-01-09 10:37:10 +0200
commitbdf07ba3adf599ac5027fd741923de7dfc41c851 (patch)
tree08f3415eb845193ff387aa2687616bb14a3ea3ea /gnosis.el
parent83a1e5d9c4a8dfb7e13ef67df1cf1913de917e05 (diff)
Add gnosis-past-or-present-p
Seperate the comparing of dates, emacsql is way too buggy for comparing lists directly
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/gnosis.el b/gnosis.el
index e37e9aa..966609f 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -710,6 +710,15 @@ if DUE is t, return only due notes"
when (not (gnosis-suspended-p note))
collect note)))
+(defun gnosis-past-or-present-p (date)
+ "Compare the input DATE with the current date.
+Return t if DATE is today or in the past, nil if it's in the future.
+DATE is a list of the form (year month day)."
+ (let* ((now (gnosis-algorithm-date))
+ (time-now (encode-time 0 0 0 (nth 2 now) (nth 1 now) (nth 0 now)))
+ (time-date (encode-time 0 0 0 (nth 2 date) (nth 1 date) (nth 0 date))))
+ (not (time-less-p time-now time-date))))
+
(defun gnosis-due-tags ()
"Return a list of due note tags."
(let ((due-notes (gnosis-review-get-due-notes)))