From 9ae9d0e1ea30b4fcc1700caafbd55a1ff08ad7b6 Mon Sep 17 00:00:00 2001 From: Protesilaos Date: Mon, 10 Aug 2026 11:38:16 +0300 Subject: [PATCH] Make stylistic change to denote--date-parse-string The original was contributed by Jeff Valk in commit 9083ad7, pull request 722: . --- denote.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/denote.el b/denote.el index dfc8239..3111d8e 100644 --- a/denote.el +++ b/denote.el @@ -3675,12 +3675,14 @@ here for clarity." (if date (format-time-string "%F %T" date) "")))) (defun denote--date-parse-string (date) - "Convert DATE to Denote's preferred string format if a recognized pattern. -Otherwise, return DATE unchanged. Currently supports Unix timestamps." - (cond ((string-match "[0-9]\\{10\\}" date) ; seconds since epoch - (let ((secs (string-to-number (match-string 0 date)))) - (format-time-string "%Y-%m-%d %H:%M:%S" (seconds-to-time secs)))) - (t date))) + "Convert DATE to Denote's preferred string format. +If DATE is a Unix timestamp, convert it accordingly." + (if-let* ((_ (string-match "[0-9]\\{10\\}" date)) ; seconds since epoch + (match (match-string 0 date)) + (seconds (string-to-number match)) + (time (seconds-to-time seconds))) + (format-time-string "%Y-%m-%d %H:%M:%S" time) + date)) (defun denote-date-prompt (&optional initial-date prompt-text) "Prompt for date, expecting YYYY-MM-DD or that plus HH:MM.