CALENDAR(1) BSD Reference Manual CALENDAR(1)
calendar - reminder service
calendar [-abP] [-A num] [-B num] [-f calendarfile] [-t [[[cc]yy][mm]]dd]
The calendar utility checks the current directory or the directory speci- fied by the CALENDAR_DIR environment variable for a file named calendar and displays lines that begin with either today's date or tomorrow's. On Fridays, events on Friday through Monday are displayed. The options are as follows: -A num Print lines from today and next num days (forward, future). -a Process the "calendar" files of all users and mail the results to them. This requires superuser privileges. -B num Print lines from today and previous num days (backward, past). -b Enforce special date calculation mode for Cyrillic calendars. -f calendarfile Use calendarfile ('-' for stdin) as the default calendar file. -P Parse the entire calendar file and convert it to an output format intended to be consumed by calendar format conversion utilities, representing the information from the original entries including year and time-of-day extensions (see below). When given twice, the original first line is also quoted before each event heading. -t [[[cc]yy][mm]]dd Act like the specified value is "today" instead of using the current date. To handle calendars in different encodings, specify "LANG=<locale_name>" in the calendar file as early as possible. That being said, there are no locales on MirBSD so calendar handles locale_name as country.encoding; country is used to make some special handling available, and encoding is used to convert the entries to UTF-8. National names for special days can be handled by adding lines such as "Advent=<national_name>" (for the Western Church first Sunday of Advent), "Easter=<national_name>" (for Catholic Easter), "Paskha=<national_name>" (for Orthodox Easter) or "Pesach=<national_name>" (for Jewish Passover), setting the corresponding variables. The "CALENDAR" variable can be used to specify the style. Only 'Julian' and 'Gregorian' styles are currently supported. Use "CALENDAR=" to return to the default (Gregorian). To enforce special date calculation mode for Cyrillic calendars specify "LANG=<locale_name>" and "BODUN=<bodun_prefix>" where <locale_name> can be ru_RU.KOI8-R, uk_UA.KOI8-U, by_BY.KOI8-B or their .UTF-8 counterparts. To enable specific anniversary handling, applied to all complete event texts that start with a four-digit year plus comma and space, or that end with comma and space and a four-digit year, appending a formatted text instead, set "ANNIV=<ago_text><us><cur_text><us><future_text>" (where us is the ASCII unit separator (Ctrl-_, 0x1F) and the texts are used if the event happened in the past, present or future, respectively; "%1$d" and "%2$d" in the texts are replaced by the year and the absolute year delta respectively), or use "ANNIV=1" which enables this mode using the default "%1$d: %2$d year(s) ago", "%1$d: this year", "%1$d: in %2$d year(s)" if none are specified otherwise. Some crazy Russian formats are also parsed, conflating "-e" ('s) and "G" (year), ignoring "do n.e." (BCE). Other lines should begin with a month and day. They may be entered in al- most any format, either numeric or as character strings. If proper locale is set, national months and weekdays names can be used (not on MirBSD which does not support locales). A single asterisk ('*') matches every month. A day without a month matches that day of every week. A month without a day matches the first of that month. Two numbers default to the month followed by the day. Lines with leading tabs default to the last entered date, allowing multiple line specifications for a single date. Advent, Easter, Paskha and Pesach, both these standard English and the user-defined national (see above) names, correspond to the respective special day for this year; they may be followed by a positive (with an explicit '+') or negative integer to offset the day. Weekday names may be followed by "-4" ... "+5" (aliases last, first, second, third, fourth) for moving events like "the last Monday in April". By convention, dates followed by an asterisk ('*') are not fixed, i.e. change from year to year. Day descriptions start after the first <tab> character in the line; if the line does not contain a <tab> character, it isn't printed out. If the first character in the line is a <tab> character, it is treated as the continuation of the previous description. Day descriptions may begin with a four-digit year (between 1000 and 2999) followed by a comma and space, and/or a time-of-day descriptor followed by a space (in either case, at least one other character is required). This is mostly useful in -P (conversion) mode, but the leading year is picked up by anniversary processing (see above) as well, and the user may appreciate this information anyway. A time-of-day specification shall be starttime[dash[endtime]][open-bracket timezone close-bracket] where starttime and endtime are 24-hour specifications (e.g. 01:23), dash is either ASCII '-' hyphen-minus or U+2013 EN DASH), open-bracket is '[', close-bracket is ']' and timezone is an Olson tzdata identifier. 24-hour specifications go from 00:00 to 23:59; 24:00 is additionally recognised but mapped to 23:59 so events stay within one day. The parse-and-extract mode output format is as follows, suppressing the normal output: - quoted original line If -PP is used, the original first line of an event specification (the one that does not start with a tab), prefixed by '>', is output first (unchanged but preprocessed). - metadata line (event heading) This line is comprised of the following fields: variable-day marker Either an asterisk '*' (if calendar would otherwise have printed one) or an equals sign '='. This field, unlike all others, is not followed by a space. date YYYY-MM-DD formatted date of either the first occurrence within a given year, if a year is part of the extended day description (see above), or the next occurrence after or starting with "today" (see above). recurrence mode This is normally one of yearly, monthly or weekly. Yearly events with a given year in the extended day description change to once. Events whose days are based on a special calculation (Advent, Easter, etc.) are special instead, independent on whether they would occur once or yearly. recurrence frequency Special events show the English name (Advent, Easter, Paskha, Pesach), followed by either a plus or minus, and a number (offset in days). Yearly and once events show -mm-dd or -mm,www+n where mm is the month number (01 to 12), dd is the day number (01 to 31), www is the weekday (Sun, Mon, Tue, Wed, Thu, Fri, Sat), and +n is either plus or minus and a number, showing the first (+1), second (+2), etc. or last (-1), penultimate (-2), etc. occurrence of the given weekday in a month. Monthly events show dd if they recur on the same day-of-month number, and www+n if they recur on one given weekday each month. Weekly events show www. year Either an asterisk ('*') or a four-digit year number. start and end times and timezone This is either one field, literally whole-day, or two fields, optionally followed by a third. The first field is a time as hh:mm; the second field either an "at" '@' (denoting no end time was given) or a time as hh:mm. The third field (if present) is a timezone name (see above). - description One or more lines prefixed by a tab character. Together, they comprise the day description with the extended part removed. Line breaks are the same as in the calendar file. https://github.com/mirabilos/ev-useful/tree/master/cal2ics is a sample postprocessor converting this format to iCalendar (*.ics) format. The calendar file is preprocessed by cpp(1), allowing the inclusion of shared files such as company holidays or meetings. If the shared file is not referenced by a full pathname, cpp(1) searches in the current (or home) directory first, and then in the directory /usr/share/calendar. Empty lines and C comments (/* ... */) are ignored. Some possible calendar entries (a \t sequence denotes a <tab> character): LANG=C Easter=Ostern #include <calendar.usholiday> #include <calendar.birthday> 6/15\tJune 15 (if ambiguous, will default to month/day). Jun. 15\tJune 15. 15 June\tJune 15. Thursday\tEvery Thursday. June\tEvery June 1st. 15 *\t15th of every month. May Sun+2\tsecond Sunday in May (Muttertag) 04/SunLast\tlast Sunday in April, \tsummer time in Europe Easter\tEaster Ostern-2\tGood Friday (2 days before Easter) Paskha\tOrthodox Easter Advent+21\t4th Sunday of Advent
calendar File in current directory. ~/.etc/calendar Directory in the user's home directory (which calendar changes into, if it exists). ~/.etc/calendar/calendar File to use if no calendar file exists in the current directory. ~/.etc/calendar/nomail calendar will not mail if this file exists. calendar.all International and national calendar files. calendar.birthday Births and deaths of famous (and not-so-famous) people. calendar.christian Christian holidays (should be updated yearly by the local system administrator so that roving holidays are set correctly for the current year). calendar.computer Computer people's days of special significance. calendar.croatian Croatian calendar. calendar.fictional Fantasy and fiction dates (mostly LOTR). calendar.french French calendar. calendar.german German calendar. calendar.history Everything else, mostly U.S. historical events. calendar.holiday Other holidays (including the not-well-known, obscure, and really obscure). calendar.judaic Jewish holidays (should be updated yearly by the local system administrator so that roving holidays are set correctly for the current year). calendar.music Musical events, births, and deaths (strongly oriented toward rock'n'roll). calendar.openbsd OpenBSD and MirBSD related events. calendar.pagan Pagan holidays, celebrations and festivals. calendar.russian Russian calendar. calendar.usholiday U.S. holidays. calendar.world World wide calendar.
at(1), cal(1), cpp(1), mail(1), cron(8) The evolvis.org "useful-scripts" repository.
The calendar program previously selected lines which had the correct date anywhere in the line. This is no longer true: the date is only recognised when it occurs at the beginning of a line.
A calendar command appeared in Version 7 AT&T UNIX. Since MirBSD #10, if the UNICODE variable is set during compilation, iconv(3) is used to convert any input to UTF-8 output. ANNIV and Advent handling appeared in MirBSD #11. Other implementations silently ignore the field assignment, so ANNIV is backwards-compatible.
calendar doesn't handle all Jewish holidays or moon phases. The lunar calendar is recognised but not implemented. MirBSD #10-current December 17, 2021 3