From efcd91978b90c724577d266428976d351dd2500e Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Thu, 14 Dec 2023 20:50:34 +0200 Subject: Add gnosis-date-difference --- gnosis.el | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gnosis.el') 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 -- cgit v1.2.3