summaryrefslogtreecommitdiff
path: root/gnosis-dashboard.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-07-23 17:01:03 +0300
committerThanos Apollo <[email protected]>2024-07-23 18:35:09 +0300
commitfeb8a4496b93b412c9f3d6197499127cdbc945fe (patch)
tree3d861e6345a157e92060488dd9801a70ff8c1ab7 /gnosis-dashboard.el
parentc65a2b3fda5e3bf5b67f28c188e425e004c394f7 (diff)
New function: dashboard-generate-dates.
* Generate all possible dates for YEAR.
Diffstat (limited to 'gnosis-dashboard.el')
-rw-r--r--gnosis-dashboard.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/gnosis-dashboard.el b/gnosis-dashboard.el
index d1eb8fb..c2279c2 100644
--- a/gnosis-dashboard.el
+++ b/gnosis-dashboard.el
@@ -56,6 +56,17 @@
'((t :inherit (outline-1) :weight bold))
"Face for the dashboard header.."
:group 'gnosis)
+
+(defun gnosis-dashboard-generate-dates (&optional year)
+ "Return a list of all dates (year month day) for YEAR."
+ (let* ((current-year (or (decoded-time-year (decode-time)) year))
+ (result '()))
+ (dotimes (month 12)
+ (let ((days-in-month (calendar-last-day-of-month (+ month 1) current-year)))
+ (dotimes (day days-in-month)
+ (push (list current-year (+ month 1) (+ day 1)) result))))
+ (nreverse result)))
+
(defun gnosis-dashboard-output-note (id)
"Output contents for note with ID, formatted for gnosis dashboard."
(cl-loop for item in (append (gnosis-select '[main options answer tags type] 'notes `(= id ,id) t)