2884 |
(redraw-calendar)) |
(redraw-calendar)) |
2885 |
|
|
2886 |
(defun calendar-date-is-visible-p (date) |
(defun calendar-date-is-visible-p (date) |
2887 |
"Return t if DATE is legal and is visible in the calendar window." |
"Return t if DATE is valid and is visible in the calendar window." |
2888 |
(let ((gap (calendar-interval |
(let ((gap (calendar-interval |
2889 |
displayed-month displayed-year |
displayed-month displayed-year |
2890 |
(extract-calendar-month date) (extract-calendar-year date)))) |
(extract-calendar-month date) (extract-calendar-year date)))) |
2891 |
(and (calendar-date-is-legal-p date) (> 2 gap) (< -2 gap)))) |
(and (calendar-date-is-legal-p date) (> 2 gap) (< -2 gap)))) |
2892 |
|
|
2893 |
(defun calendar-date-is-legal-p (date) |
(defun calendar-date-is-legal-p (date) |
2894 |
"Return t if DATE is a legal date." |
"Return t if DATE is a valid date." |
2895 |
(let ((month (extract-calendar-month date)) |
(let ((month (extract-calendar-month date)) |
2896 |
(day (extract-calendar-day date)) |
(day (extract-calendar-day date)) |
2897 |
(year (extract-calendar-year date))) |
(year (extract-calendar-year date))) |
2898 |
(and (<= 1 month) (<= month 12) |
(and (<= 1 month) (<= month 12) |
2899 |
(<= 1 day) (<= day (calendar-last-day-of-month month year)) |
(<= 1 day) (<= day (calendar-last-day-of-month month year)) |
2900 |
;; BC dates left as non-legal, to suppress errors from |
;; BC dates left as non-valid, to suppress errors from |
2901 |
;; complex holiday algorithms not suitable for years BC. |
;; complex holiday algorithms not suitable for years BC. |
2902 |
;; Note there are side effects on calendar navigation. |
;; Note there are side effects on calendar navigation. |
2903 |
(<= 1 year)))) |
(<= 1 year)))) |