From ed2d9f6348cf90c6e855fe37eba6e5943386b5b7 Mon Sep 17 00:00:00 2001 From: Jai Flack Date: Thu, 24 Mar 2022 23:27:33 +1000 Subject: [PATCH] Properly format dates as ISO YYYY-MM-DD HH:MM:SS --- gnus-search-mu.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gnus-search-mu.el b/gnus-search-mu.el index 4a8fe31..1990ffa 100644 --- a/gnus-search-mu.el +++ b/gnus-search-mu.el @@ -140,12 +140,19 @@ This can also be set per-server." (nth (1- m) gnus-english-month-names)) (`(nil nil ,y) (number-to-string y)) + ;; mu prefers ISO date YYYY-MM-DD HH:MM:SS (`(,d ,m nil) - (format "%02d-%02d" d m)) + (let* ((ct (decode-time)) + (cm (decoded-time-month ct)) + (cy (decoded-time-year ct)) + (y (if (> cm m) + cy + (1- cy)))) + (format "%d-%02d-%02d" y m d))) (`(nil ,m ,y) - (format "%02d-%02d" m y)) + (format "%d-%02d" y m)) (`(,d ,m ,y) - (format "%d/%d/%d" m d y)))))) + (format "%d-%02d-%02d" y m d)))))) (cond ((consp (car expr)) (format "(%s)" (gnus-search-transform engine expr)))