diff options
| -rw-r--r-- | lisp/calendar/time-date.el | 2 | ||||
| -rw-r--r-- | test/lisp/calendar/time-date-tests.el | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el index e2402de8010..9b58a4884bc 100644 --- a/lisp/calendar/time-date.el +++ b/lisp/calendar/time-date.el | |||
| @@ -355,6 +355,8 @@ is output until the first non-zero unit is encountered." | |||
| 355 | 355 | ||
| 356 | (defun date-days-in-month (year month) | 356 | (defun date-days-in-month (year month) |
| 357 | "The number of days in MONTH in YEAR." | 357 | "The number of days in MONTH in YEAR." |
| 358 | (unless (<= 1 month 12) | ||
| 359 | (error "Month %s invalid" month)) | ||
| 358 | (if (= month 2) | 360 | (if (= month 2) |
| 359 | (if (date-leap-year-p year) | 361 | (if (date-leap-year-p year) |
| 360 | 29 | 362 | 29 |
diff --git a/test/lisp/calendar/time-date-tests.el b/test/lisp/calendar/time-date-tests.el index 4c8f18a7a95..9c90300cfe6 100644 --- a/test/lisp/calendar/time-date-tests.el +++ b/test/lisp/calendar/time-date-tests.el | |||
| @@ -31,7 +31,8 @@ | |||
| 31 | (ert-deftest test-days-in-month () | 31 | (ert-deftest test-days-in-month () |
| 32 | (should (= (date-days-in-month 2004 2) 29)) | 32 | (should (= (date-days-in-month 2004 2) 29)) |
| 33 | (should (= (date-days-in-month 2004 3) 31)) | 33 | (should (= (date-days-in-month 2004 3) 31)) |
| 34 | (should-not (= (date-days-in-month 1900 3) 28))) | 34 | (should-not (= (date-days-in-month 1900 3) 28)) |
| 35 | (should-error (date-days-in-month 2020 15))) | ||
| 35 | 36 | ||
| 36 | (ert-deftest test-ordinal () | 37 | (ert-deftest test-ordinal () |
| 37 | (should (equal (date-ordinal-to-time 2008 271) | 38 | (should (equal (date-ordinal-to-time 2008 271) |