[email protected] archives
 help / color / mirror / Atom feed
From: Ihor Radchenko <[email protected]>
To: Morgan Smith <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH] Add test suite for org habit
Date: Sat, 18 Oct 2025 18:31:22 +0000	[thread overview]
Message-ID: <87jz0sjc60.fsf@localhost> (raw)
In-Reply-To: <CH3PR84MB342451672330892DD73B7FBDC5F7A@CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM>

Morgan Smith <[email protected]> writes:

>> 1. One of the tests is failing on my side:
>>    FAILED  test-org-habit/following-days 
>
> TLDR: This is a bug in org-habit.  Is there a robust way to add days to
> a time object?

One way is directly passing days + disabled DFT to `encode-time'. (I think)

> This test takes place on "Sat Oct 17 00:00:00 2009".  Then in
> `org-habit-insert-consistency-graphs' we run this snippet to add (in the
> specific case of the test failure) 20 days:
>
> `(time-add moment (days-to-time org-habit-following-days))'
>
> This of course results in a date 20 days in the future of "Thu Nov 5
> 23:00:00 2009".  Wait that's not 20 days.  That's 19 days and 23 hours.
> Oh dear.

Looks like DST indeed.

> ELISP> (current-time-string 
>         (encode-time 
>          (decoded-time-add
>           (decode-time 1255752000)
>           (make-decoded-time :day 20))))
> "Thu Nov  5 23:00:00 2009"
>
>
> I imagine the solution might be in calendar.el?

org-agenda often uses `calendar-absolute-from-gregorian' for this.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



  reply	other threads:[~2025-10-18 18:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-03 18:23 [PATCH] Add test suite for org habit Morgan Smith
2025-10-04  0:06 ` John Wiegley
2025-10-18 13:14 ` Ihor Radchenko
2025-10-18 18:05   ` Morgan Smith
2025-10-18 18:31     ` Ihor Radchenko [this message]
2025-10-19  1:44       ` Morgan Smith
2025-10-19 12:07         ` Ihor Radchenko
2025-10-19 19:30           ` Morgan Smith
2025-10-25 13:17             ` Ihor Radchenko
2025-10-25 16:10               ` Morgan Smith
2025-10-25 17:22                 ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jz0sjc60.fsf@localhost \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).