comparison lisp/calendar/calendar.el @ 80704:c96e0ea166fc

(calendar-nth-named-absday, calendar-nth-named-day): Doc fixes (sync from trunk 2008-04-29).
author Glenn Morris <rgm@gnu.org>
date Sun, 10 Aug 2008 20:07:11 +0000
parents 974a828870fe
children 5074702340f6
comparison
equal deleted inserted replaced
80703:818d77e04d72 80704:c96e0ea166fc
3050 absolute date d, applying it to d-1 gives the DAYNAME previous to absolute 3050 absolute date d, applying it to d-1 gives the DAYNAME previous to absolute
3051 date d, and applying it to d+7 gives the DAYNAME following absolute date d." 3051 date d, and applying it to d+7 gives the DAYNAME following absolute date d."
3052 (- date (% (- date dayname) 7))) 3052 (- date (% (- date dayname) 7)))
3053 3053
3054 (defun calendar-nth-named-absday (n dayname month year &optional day) 3054 (defun calendar-nth-named-absday (n dayname month year &optional day)
3055 "The absolute date of Nth DAYNAME in MONTH, YEAR before/after optional DAY. 3055 "Absolute date of the Nth DAYNAME after/before MONTH YEAR DAY.
3056 A DAYNAME of 0 means Sunday, 1 means Monday, and so on. If N<0, 3056 A DAYNAME of 0 means Sunday, 1 means Monday, and so on.
3057 return the Nth DAYNAME before MONTH DAY, YEAR (inclusive).
3058 If N>0, return the Nth DAYNAME after MONTH DAY, YEAR (inclusive). 3057 If N>0, return the Nth DAYNAME after MONTH DAY, YEAR (inclusive).
3059 3058 If N<0, return the Nth DAYNAME before MONTH DAY, YEAR (inclusive).
3060 If DAY is omitted, it defaults to 1 if N>0, and MONTH's last day otherwise." 3059 DAY defaults to 1 if N>0, and MONTH's last day otherwise."
3061 (if (> n 0) 3060 (if (> n 0)
3062 (+ (* 7 (1- n)) 3061 (+ (* 7 (1- n))
3063 (calendar-dayname-on-or-before 3062 (calendar-dayname-on-or-before
3064 dayname 3063 dayname
3065 (+ 6 (calendar-absolute-from-gregorian 3064 (+ 6 (calendar-absolute-from-gregorian
3071 (list month 3070 (list month
3072 (or day (calendar-last-day-of-month month year)) 3071 (or day (calendar-last-day-of-month month year))
3073 year)))))) 3072 year))))))
3074 3073
3075 (defun calendar-nth-named-day (n dayname month year &optional day) 3074 (defun calendar-nth-named-day (n dayname month year &optional day)
3076 "The date of Nth DAYNAME in MONTH, YEAR before/after optional DAY. 3075 "Date of the Nth DAYNAME after/before MONTH YEAR DAY.
3077 A DAYNAME of 0 means Sunday, 1 means Monday, and so on. If N<0, 3076 Like `calendar-nth-named-absday', but returns a Gregorian date."
3078 return the Nth DAYNAME before MONTH DAY, YEAR (inclusive).
3079 If N>0, return the Nth DAYNAME after MONTH DAY, YEAR (inclusive).
3080
3081 If DAY is omitted, it defaults to 1 if N>0, and MONTH's last day otherwise."
3082 (calendar-gregorian-from-absolute 3077 (calendar-gregorian-from-absolute
3083 (calendar-nth-named-absday n dayname month year day))) 3078 (calendar-nth-named-absday n dayname month year day)))
3084 3079
3085 (defun calendar-day-of-year-string (&optional date) 3080 (defun calendar-day-of-year-string (&optional date)
3086 "String of day number of year of Gregorian DATE. 3081 "String of day number of year of Gregorian DATE.