How to Use


eralegis.js — Javascript helper library for rendering Era Legis dates

The purpose of this time service is to provide a relatively easy means of including the Thelemic date into HTML content as plain old text rather than images. Unlike images, text can be styled with CSS, flows more evenly with the surrounding content, and can be scaled and transformed in numerous ways.

To include the current Thelemic date, the simplest usage of this API is:

<span class="date93"></span>
...
<script src="https://eralegis.info/eralegis-2.0.js"></script>

The date93 class triggers the functionality. The element could be a <span>, <div>, <p>, or many other elements so long as they are assigned that class. The style of the date output as well as the time zone or using a date other than the present can be controlled by setting attributes to this element. This is best described with a few examples, the markup followed by the stylized output.

If you want to pull dates from an alternate API server instead of the date.eralegis.info host, set the window.eralegisBaseUrl value to that URL before loading the eralegis.js script.

(The 1.0 version of this library depended on jQuery being loaded. Version 2.0 and beyond have no dependencies and will work without jQuery.)

Examples

<span data-evdate="2012-12-09 05:35:00" class="date93"></span>

☉ in 17° Sagittarii : ☽ in 20° Librae : dies Solis : Anno ⅠⅤⅹⅹ æræ legis
<span data-evdate="2012-12-09 05:35:00" data-tz="US/Pacific" class="date93"></span>

☉ in 17° Sagittarii : ☽ in 20° Librae : dies Saturni : Anno ⅠⅤⅹⅹ æræ legis
<span data-evdate="2012-12-09 05:35:00" data-show-deg="0" class="date93"></span>

☉ in Sagittario : ☽ in Libra : dies Solis : Anno ⅠⅤⅹⅹ æræ legis
<span data-evdate="2012-12-09 05:35:00" data-lang="symbol" class="date93"></span>

☉ in 17° ♐ : ☽ in 20° ♎ : ☉ : ⅠⅤⅹⅹ
<span data-evdate="2012-12-09 05:35:00" class="date93" data-show-deg="0" data-show-dow="0" data-show-year="0" data-show-terse="1" data-lang="symbol"></span>

☉ ♐ : ☽ ♎

If the standard attribute flags don’t provide enough configurability, the output can be run through a custom template:

<span data-evdate="2012-12-09 05:35:00" class="date93" data-lang="english">Sol in {ssign}, Luna in {lsign}, {dow}</span>

Sol in Sagittarius, Luna in Libra, Sunday
<span data-evdate="2012-12-09 05:35:00" class="date93" data-lang="symbol">Our Lord and Father the Sun in {sdeg}° {ssign}, year {year1}:{year2}</span>

Our Lord and Father the Sun in 17° ♐, year ⅠⅤ:ⅹⅹ

The template variables are ssign, sdeg, lsign, ldeg, dow, year1, year2.

Attributes

General attributes:

data-evdate
A date or timestamp in ISO8601 format (e.g. YYYY-MM-DD HH:MM:SS). Defaults to now.
data-lang
One of latin (default), english, symbol, or poor-latin.
data-tz
Appropriate time zone values are TZ values from the IANA zoneinfo database (common list here). Only used for day-of-week calculation. Defaults to UTC.
data-roman-year
Render year values in Roman numerals. Defaults to 1. Set to 0 for Arabic.

Attributes which alter the default template:

data-show-terse
Render the “in” in “Sol in Pisces”. Defaults to 0.
data-show-deg
Render the numeric degree value and degree symbol. Defaults to 1.
data-show-dow
Render the day of the week. Defaults to 1.
data-show-year
Render the year. Defaults to 1.

Other notes

The server side of this service is a small Mojolicious application built around the DateTime::Format::EraLegis Perl module.

Override the default EraLegis server URL by setting eralegis.base_url immediately after the loading the script.

Missing or garbled symbols in the rendered dates are almost certainly the result of the font in use having no sigils for the corresponding Unicode code points. In particular, fonts frequently lack the zodiacal symbols. If you run into this try using another font or possibly use CSS to switch to another font for just those characters. Suggestions for more elegant and robust solutions to this problem are welcome.


Era Legis Image Renderer

Instead of pulling the date as text, the solar date can also be rendered into a PNG image file for inclusion in HTML documents. The client indicates this by either specifying a format=png or appending .png to the URI path. The calling format will look something like:

<img src="https://date.eralegis.info/2018-12-10T12:34:56.png?tz=US/Pacific">
<img src="https://date.eralegis.info/now.png?lang=symbol">
<img src="https://date.eralegis.info/2018-12-10T12:34:56?format=png&tz=US/Pacific">

In addition to the parameters shown above for the eralegis.js library (with the data- prefix removed), these further parameters are available:

color
A three- or six-digit hexadecimal value.
font
One of serif (default), sans, code, or mono.
points
Numeric point size for the font.

Era Legis Date Picker

The front page of this site hosts a date picker tool that’s useful for quickly converting vulgar dates into solar ones. The Elm source for this tool is available on Gitlab.