last revisions: 11-7-2001

Calender Handling in Libeth 0.40

This document contains draft segments of two other documents. It is does not in itself comprise a complete document nor specification. This document is posted to solicit feedback on the changes under consideration herein.


estrftime in LibEth Calendar Codes 0.20

The 0.2 version of the calendar conversion utilities that are a part of libeth will feature an extensively reworked version of the estrftime function. The new version will handle locale support by making preemptive interpretation of the extended conversion specifiers of standard strftime.

The following table illustrates the interpretations proposed:

Attributes of Ethiopian Names

Field Interpretation
%Ec is not interpreted.
%EC is replaced by `a/`a for years less than 0
is replaced by `a/m for years greater than 0
is ignored for the year 0
%Ex is not interpreted.
%EX is not interpreted.
%Ey is replaced by the year in the Ethiopic calendar and represented with western numerals.
%EY is replaced by the year in the Ethiopic calendar and represented with Ethiopic numerals.
%Od is replaced by day of the month with Ethiopic numerals, filled in as needed with leading spaces.
%Oe is replaced by day of the month with Ethiopic numerals, filled in as needed with leading spaces.
%OH is replaced by the hour (24-hour clock) using the -6 hour convention.
%OI is replaced by the hour (12-hour clock) using the -6 hour convention.
%Om is replaced by the month using Ethiopic numerals.
%OM is not interpreted.
%OS is not interpreted.
%Ou is replaced by the weekday as an Ethiopic number (Monday=`1).
%OU is replaced by the week number of the year (Sunday as the first day of the week, rules correspond to %V) in Ethiopic numerals.
%OV is replaced by the week number of the year (Monday as the first day of the week, rules correspond to %V) in Ethiopic numerals.
%Ow is replaced by the number of the weekday (Sunday=0) using Ethiopic numerals.
%OW is replaced by the week number of the year (Monday as the first day of the week) using Ethiopic numerals.
%Oy is replaced by the year (offset from %C) using Ethiopic numerals.

The conversion specifiers require only conversion between numeral systems in most cases. %Om and %Oy specify a change of numerals systems and do not require priori conversion into the Ethiopian calendar system. To force dates into an Ethiopic context the 0.2 interpreter will recognize hyphen, '-', which will force a date conversion before the token replacement. Dates already in the Ethiopic context will be left unmodified and not converted into the Western system. Recognized - extensions will be:

%-b is replaced by the locale's abbreviated month name in the Ethiopian calendar system.
%-B is replaced by the locale's full month name in the Ethiopian calendar system.
%-m is replaced by the month using Ethiopic numerals in the Ethiopian calendar system.
%-Om is replaced by the month using Ethiopic numerals in the Ethiopian calendar system.
%-Oy is replaced by the year (offset from %C) using Ethiopic numerals in the Ethiopian calendar system.

Additional specifiers are defined for properties of Ethiopic dates believed to be useful for calendar programming:

%-q Day name modifier (qen, m`alti).
%-ta Name of tabot
%-ts Name of current (inner most) tsom (if any)
%-tsm Name of current (outer most) tsom (if any)
%-EN name of era (yoHenes, marqos, luqas, matEos)
%-ms Name of star for the current month.
%-ys Name of star for the current year.
%-sds Name of star for the current day (Sidamo).
%-sdm Name of star for the current market day (Sidamo).


Calendrical Scripting Extension to the LiveGe'ez Remote Processing Protocol

4.3.1 The Date Conversion Attribute

The date conversion attribute is analogous to the day, month and year CGI parameters of Subsection 3.4. The difference in using a single "date" attribute is that the day, month and year attribute values are grouped in a comma separated list to form the "date" attribute value. The calendar system of the date numeric values may be included as the last item of the list. The calendar system of the date attribute alternatively be indicated with a "calIn" attribute, the first form however is the preferred:


<LIVEGEEZ date="DATE">
<LIVEGEEZ date="DATE" lang="LANG">
<LIVEGEEZ date="DATE" lang="LANG" calOut="CALSYS">
<LIVEGEEZ date="DATE" lang="LANG" calOut="CALSYS" format="FORMAT">
<LIVEGEEZ date="DATE" lang="LANG" calOut="CALSYS" prop="PROPERTY">
<LIVEGEEZ date="DATE" lang="LANG" calOut="CALSYS" (format="FORMAT" | prop="PROPERTY") name="NAME">


DATE    :=  "today"
         |  day "," month "," year
         |  day "," month "," year "," CALSYS
         ;  day, month, and year tokens were defined in Table 3.3.1
         ;  CALSYS here corresponds to the calIn parameter.
         ;  Ethiopic calendar is assumed when CALSYS is omitted.

FORMAT  := <a valid estrftime format> ;

PROP    := "day"
         | "eday"
         | "eyear"
         | "day-name"
         | "month"
         | "month-name"
         | "holiday"
         | "year"
         | "eyear"
         | "year-name"
         | "tsom" | "tsom-minor"
         | "tsom-major"
         | "tabot"
         | "month-star"
         | "year-star"
         | "sid-star-day"
         | "sid-market-day"
         ;

NAME    := [A-Za-z0-9]+ ;

The "name" attribute is another new introduction. The name attribute allows us to make future references to a LiveGe'ez date declaration. This is convenient for calendrical scripting as we do not have to respecify the date parameter and other initial attributes each time the same date is to be used. After the initial declaration, modifications made to a named date (such as a lang or calOut settings) will remain for future use.

Date Properties

The "prop" attribute is a shortcut to composing a date format where the specifiers can be difficult to remember. Likewise the "prop" and "format" attributes can not be used together. The "prop" attribute may be thought of as invoking a method on a date object. For example: <LIVEGEEZ date="29,4,1991,et" name="day1"> instantiates a date object named "day1". Then <LIVEGEEZ name="day1" lang="gez" prop="day-name"> would be equivalent to day1.day_name( "gez" ) which would print the weekday name for 29/4/1991 in the Ethiopic calendar system in the Ge'ez language.

day Equivalent to "%d".
eday Equivalent to "%Ou".
day-name Equivalent to "%A".
month Equivalent to "%m".
month-name Equivalent to "%B".
year Equivalent to "%y".
eyear Equivalent to "%EY".
year-name Equivalent to "%EN".
tabot Equivalent to "%-ta".
tsom
tsom-minor
Equivalent to "%-ts".
tsom-major Equivalent to "%-tsm".
month-star Equivalent to "%-ms".
year-star Equivalent to "%-ys".
sid-star-day Equivalent to "%-sds".
sid-market-day Equivalent to "%-sdm".

Examples:

Markup . Output

<LIVEGEEZ date="today"> The current date (server side) in Ethiopic context.
<LIVEGEEZ date="29,4,1991" lang="tir"> Tahsas 29, 1991 in Tigrigna spelling and formatting.
<LIVEGEEZ date="29,4,1991" calOut="eu" lang="fr.ch"> January 7, 1999 in Swiss French spelling and formatting. calOut forced a conversion.
<LIVEGEEZ date="7,1,1999,eu" calOut="et" lang="amh"> Tahsas 29, 1991 in Amharic spelling and formatting.
<LIVEGEEZ date="today" name="zare"> Declare a date handle named "zare" for the current date.
<LIVEGEEZ date="1,1,1994,et" calOut="eu" name="mes"> Declare a date handle named "mes" for an Ethiopic date converted to Gregorian.
<LIVEGEEZ date="1,1,2001,eu" calOut="et" name="jan"> Declare a date handle named "jan" for a Gregorian date converted to Ethiopic.

The final three examples above apply the "name" referencing mechanism. A practical example that illustrates their use follows:

<p>Today would be <livegeez prop="day-name" name="zare"> since it is the <livegeez prop="day" name="zare"> day of the month (<livegeez prop="month-name" name="zare"> aka <livegeez prop="month-name" lang="tir" name="zare">). In Sidamo the market day is <i><livegeez prop="sid-market-day"></i>. The Tabot for today is "<livegeez prop="tabot" name="zare">" and a tsom (if any) is "<livegeez prop="tsom" name="zare">". </p>

<p> European new year was on <livegeez format="%A, %B %-q %EY %EC" name="jan">. Ethiopian new year however will be on <livegeez format="%A, %B %Y" name="mes">. </p>