Skip to Content

Era Legis Version 3

I’ve published version 3 of the Era Legis toolchain. This release contains a couple of new features to improve accuracy, timezone autodetection and location input and detection. It also eliminates the former dependency on jQuery.

When using the JS library to embed dates, if you omit the data-tz parameter the module will automatically apply the time offset provided by the user’s browser (which in turn is provided by the operating system). If data-tz is supplied, the zone offset reported by the browser is ignored.

There is also a new parameter, data-location. This is for providing geodetic coordinates to be used for calculating the day of week. Prior to this version, Era Legis used civil midnight as the cutoff for determining which day of the week the request date falls on, as is used for the vulgar calendar. This differs from traditional determination of planetary days, which uses sunrise as the transition point between one day and the next. Era Legis can now be supplied with geodetic coordinates specifying a location to be used for sunrise calculation. These coordinates can be supplied manually, like data-location="45.5:-122.75" to always use that location as the reference point. It’s also possible to pass data-location="auto" to rely on the current user’s location as reported by the browser. Additionally, if no location is provided at all, a default sunrise time of 6am is now used rather than vulgar midnight.

Using the browser’s self-reported location is a neat trick, but one should be wary about using it when adding Era Legis dates dynamically to your website. Unlike the automatic timezone detection, location data is very privacy sensitive. Specifying auto location will trigger a request to every user for permission to view their location info. Even though a viewer can decline to share their location, it can be rather (and rightfully so) alarming and disruptive to their experience to be prompted for it. To the casual viewer, it’s impossible to determine that such sensitive data is only being used for sunrise calculations, not nefarious tracking. It is for this reason that autolocation is disabled by default in the JS library, and I caution web creators who embed Era Legis dynamic dates into their content to be judicious about enabling it.

In order to use these new features you’ll need to load the v3 script, which has a new, versioned URL: Since this version is just plain Javascript, it no longer requires having jQuery loaded. If you don’t rely on jQuery for other purposes you can remove that script from your site and save your readers a bit of initial load time.

The picker tool has been updated for both of these features, as well, under the new options list. Also, to be clear, if you are using the picker to copy/paste dates statically into web content, using the location autodetect will only prompt you for your location at the time you’re picking your date. Viewers of your website will not be prompted.

If you encounter any bugs or have questions, please feel welcome to file an issue on Gitlab or contact me directly.