Archived
1
0
Fork 0

add basic time helper functions for use in complex capture templates

This commit is contained in:
KemoNine 2023-04-17 10:25:06 -04:00
parent b777182c81
commit 54658e937e

View file

@ -191,3 +191,23 @@ position between last non-whitespace and `end-of-line'."
(interactive)
(kmn/dock-current-buffer-on-side 'bottom)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; perform days math on a date string
(defun kmn/date-string-days-math (date-string days-to-subtract)
(format-time-string "%Y-%m-%d"
(encode-time
(decoded-time-add (parse-time-string date-string) (make-decoded-time :day days-to-subtract))
)
))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; subtract 7 days from a date string
(defun kmn/date-string-minus-seven-days (date-string)
(kmn/date-string-days-math date-string -7)
)
; subtract 3 days from a date string
(defun kmn/date/string/minus-three-days (date-string)
(kmn/date-string-days-math date-string -3)
)