Subject: [PATCH v3 2/4] approxidate: alias "today" to "now"

From: Tuomas Ahola <[email-masked]>
Date: Thu, 14 May 2026 14:55:18 +0300

As far as approxidate in concerned, "today" is a no-op.  That makes
it functionally equivalent to "now" in commands like

        $ git log --since=today

Make that behavior explicit by binding "today" to `date_now()`.
That way later patches can give "today" some functionality in
cases like "today at noon".

Signed-off-by: Tuomas Ahola <[email-masked]>
---

Notes:
    > Hmph, this may not work very well for "git log --since=today", which
    > you may want to stop immediately when the traversal reaches a patch
    > written before the most recent midnight, instead of stopping without
    > giving anything back.
    >
    
    Sorry, I don't know if I understood.  Does the patch change the behavior of
    that command somehow?  Is there some kind of edge case I missed?
    
    That said, if we do want to change it so that "git log --since=today"
    worked like "--since=midnight", this seems to do the trick:
    
    ```
    static void date_today(struct tm *tm, struct tm *now, int *num)
    {
    	if (tm->tm_hour == now->tm_hour &&
    	    tm->tm_min == now->tm_min &&
    	    tm->tm_sec == now->tm_sec)
    		date_midnight(tm, now, num);
    	date_now(tm, now, num);
    }
    ```

 date.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/date.c b/date.c
index 17a95077cf..412aca6dc4 100644
--- a/date.c
+++ b/date.c
@@ -1204,6 +1204,7 @@ static const struct special {
 	{ "AM", date_am },
 	{ "never", date_never },
 	{ "now", date_now },
+	{ "today", date_now },
 	{ NULL }
 };
 
-- 
2.30.2