GNU bug report logs -
#43677
27.1; Calc holidays off-by-one error, incorrect business day calculation
Previous Next
Reported by: Aaron Zeng <zeng.aaron.l <at> gmail.com>
Date: Mon, 28 Sep 2020 16:12:03 UTC
Severity: normal
Found in version 27.1
Done: Mattias EngdegÄrd <mattiase <at> acm.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> Indeed -- applying the following patch (which numbers Monday as 0 and Sunday as 6) makes the test case work correctly for me. But trying to follow the code makes it unclear... er... what's going on, and there aren't many comments in the Calc code to explain what they were thinking.
Welcome to Calc!
> I wondered whether this might be a US/non-US thing (with a difference in what day starts the week), but I couldn't really find anything in calc talking about that...
The weekday numbering can be arbitrary as long as it is only used internally. Calc's date representation (from Rata Die) sets Dec 31, 1 B.C. as day 0, and this happens to be a Sunday. That means that (mod DAY 7) is an easy way to get the week-starts-on-Sunday numbering used by some foreigners.
Since the bug is a regression -- it is present in Emacs 26.1 but not in 22.1.1 -- it may be a good idea to find out exactly what change introduced it, and work from there. That might reduce the risk of causing secondary bugs.
This bug report was last modified 4 years and 236 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.