emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/denote edda750506 04/11: Handle nil date in front matte


From: ELPA Syncer
Subject: [elpa] externals/denote edda750506 04/11: Handle nil date in front matter date functions
Date: Mon, 16 Dec 2024 03:58:29 -0500 (EST)

branch: externals/denote
commit edda7505063be6c1faea05c3a51faddbe1de06f9
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>

    Handle nil date in front matter date functions
---
 denote.el | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/denote.el b/denote.el
index 85867ea2d3..7f17136726 100644
--- a/denote.el
+++ b/denote.el
@@ -2243,26 +2243,30 @@ which case it is not added to the base file name."
 ;; package: <https://github.com/kaushalmodi/ox-hugo>.
 (defun denote-date-rfc3339 (date)
   "Format DATE using the RFC3339 specification."
-  (replace-regexp-in-string
-   "\\([0-9]\\{2\\}\\)\\([0-9]\\{2\\}\\)\\'" "\\1:\\2"
-   (format-time-string "%FT%T%z" date)))
+  (if date
+      (replace-regexp-in-string
+       "\\([0-9]\\{2\\}\\)\\([0-9]\\{2\\}\\)\\'" "\\1:\\2"
+       (format-time-string "%FT%T%z" date))
+    ""))
 
 (defun denote-date-org-timestamp (date)
   "Format DATE using the Org inactive timestamp notation."
-  (format-time-string "[%F %a %R]" date))
+  (if date
+      (format-time-string "[%F %a %R]" date)
+    ""))
 
 (defun denote-date-iso-8601 (date)
   "Format DATE according to ISO 8601 standard."
-  (format-time-string "%F" date))
+  (if date
+      (format-time-string "%F" date)
+    ""))
 
 (defun denote--format-front-matter-date (date file-type)
   "Expand DATE in an appropriate format for FILE-TYPE."
   (let ((format denote-date-format))
     (cond
-     ((null date)
-      "")
      (format
-      (format-time-string format date))
+      (if date (format-time-string format date) ""))
      ((when-let* ((fn (denote--date-value-function file-type)))
         (funcall fn date)))
      (t



reply via email to

[Prev in Thread] Current Thread [Next in Thread]