summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-12-14 20:50:34 +0200
committerThanos Apollo <[email protected]>2023-12-14 20:50:34 +0200
commitefcd91978b90c724577d266428976d351dd2500e (patch)
treec5e0b26094e97fc28a87c4c63de57cd8fcc50d7f /gnosis.el
parentdd40cde2399089ab28a62a32fec32320fa7f2ba0 (diff)
Add gnosis-date-difference
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 fcf94fc..fa67683 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -286,6 +286,15 @@ Optional integer OFFSET is a number of days from the current date."
(+ offset (calendar-absolute-from-gregorian now))))))
(list (nth 2 date) (nth 0 date) (nth 1 date)))))
+(defun gnosis-date-difference (year month day)
+ "Find the difference between the current date and the given date.
+
+The structure of the given date is (YEAR MONTH DAY)."
+ (let ((current-date (gnosis-date-current))
+ (given-date (encode-time 0 0 0 day month year)))
+ (- (time-to-days (current-time))
+ (time-to-days given-date))))
+
(defun gnosis-calculate-e-factor (ef quality)
"Calculate new e-factor given existing EF and binary QUALITY, 0 or 1."
(cond