]> git.eshelyaron.com Git - emacs.git/commit
Calc: fix business days calculation (bug43677)
authorMattias Engdegård <mattiase@acm.org>
Wed, 30 Sep 2020 21:57:27 +0000 (23:57 +0200)
committerMattias Engdegård <mattiase@acm.org>
Fri, 2 Oct 2020 08:35:52 +0000 (10:35 +0200)
commit4cb16b6f42ea7ea088fa4134f8fe4ccfec16a56d
tree618a3b8e1b61b6092fdb81dc7ead79c0794a453e
parentd037a6a2e6f92d793b1d5403dea4c7d3ca70883c
Calc: fix business days calculation (bug43677)

The calculation of business days was broken in 2012 (probably
310e60d9454fe2 or thereabouts) when the date representation changed
epoch so that Jan 1, 1 AD became day number 1 instead of 0.  Repair
this, along with an unrelated bug that prevented arbitrary holiday
weekdays from working.

Reported by Aaron Zeng.

* lisp/calc/calc-forms.el (math-to-business-day)
(math-from-business-day): Correct calculation of weekdays using Calc's
current (Rata Die) chronology.  Modify loop condition to cope with odd
sets of holiday weekdays.
* test/lisp/calc/calc-tests.el (calc-business-days): New test.
lisp/calc/calc-forms.el
test/lisp/calc/calc-tests.el