Fix spurious display of eclipses in Calendar
* lisp/calendar/lunar.el (eclipse-check): Don't show an eclipse unless the phase is new moon or full moon. (bug#61460) * test/lisp/calendar/lunar-tests.el (lunar-test-eclipse-check) (lunar-test-phase-list): Update tests.
This commit is contained in:
parent
f2114e8d89
commit
cc30422825
2 changed files with 18 additions and 13 deletions
|
@ -161,7 +161,9 @@ remainder mod 4 gives the phase: 0 new moon, 1 first quarter, 2 full moon,
|
|||
(phase-name (cond ((= phase 0) "Solar")
|
||||
((= phase 2) "Lunar")
|
||||
(t ""))))
|
||||
(cond ((< moon-lat 2.42600766e-1)
|
||||
(cond ((string= phase-name "")
|
||||
"")
|
||||
((< moon-lat 2.42600766e-1)
|
||||
(concat "** " phase-name " Eclipse **"))
|
||||
((< moon-lat 0.37)
|
||||
(concat "** " phase-name " Eclipse possible **"))
|
||||
|
|
|
@ -43,21 +43,24 @@
|
|||
|
||||
(ert-deftest lunar-test-eclipse-check ()
|
||||
(with-lunar-test
|
||||
(should (equal (eclipse-check 1 1) "** Eclipse **"))))
|
||||
(should (equal (eclipse-check 10.0 1) ""))
|
||||
(should (equal (eclipse-check 10.0 2) "** Lunar Eclipse **"))))
|
||||
|
||||
(ert-deftest lunar-test-phase-list ()
|
||||
(with-lunar-test
|
||||
(should (equal (lunar-phase-list 3 1871)
|
||||
'(((3 21 1871) "04:03" 0 "")
|
||||
((3 29 1871) "06:46" 1 "** Eclipse **")
|
||||
((4 5 1871) "14:20" 2 "")
|
||||
((4 12 1871) "05:57" 3 "** Eclipse possible **")
|
||||
((4 19 1871) "19:06" 0 "")
|
||||
((4 27 1871) "23:49" 1 "")
|
||||
((5 4 1871) "22:57" 2 "")
|
||||
((5 11 1871) "14:29" 3 "")
|
||||
((5 19 1871) "10:46" 0 "")
|
||||
((5 27 1871) "13:02" 1 ""))))))
|
||||
(should (equal (lunar-phase-list 9 2023)
|
||||
'(((9 6 2023) "22:27" 3 "")
|
||||
((9 15 2023) "01:40" 0 "")
|
||||
((9 22 2023) "19:33" 1 "")
|
||||
((9 29 2023) "09:54" 2 "** Lunar Eclipse possible **")
|
||||
((10 6 2023) "13:53" 3 "")
|
||||
((10 14 2023) "17:55" 0 "** Solar Eclipse **")
|
||||
((10 22 2023) "03:30" 1 "")
|
||||
((10 28 2023) "20:20" 2 "** Lunar Eclipse **")
|
||||
((11 5 2023) "08:42" 3 "")
|
||||
((11 13 2023) "09:27" 0 "")
|
||||
((11 20 2023) "10:51" 1 "")
|
||||
((11 27 2023) "09:13" 2 ""))))))
|
||||
|
||||
(ert-deftest lunar-test-new-moon-time ()
|
||||
(with-lunar-test
|
||||
|
|
Loading…
Add table
Reference in a new issue