npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@devexy/jdnconvertiblecalendar

v1.0.0

Published

Conversions between various calendars and manipulations using Julian Day Number (JDN)

Downloads

23

Readme

JDNConvertibleCalendar

General Remarks

Please note that this software is still in a early state of development. Currently, only the Gregorian and Julian calendar are supported.

Introduction

JDNConvertibleCalendar offers a convenient way to convert a given date to other calendars making use of the Julian Day. The Julian Day is the continuous count of days since the beginning of the Julian Period in 4713 BCE. The Julian Day Count (JDC) contains a fraction that represents the daytime. A fraction of .5 represents midnight and .0 represents noon. For example, the day with the date January 27th 1987 starts with the JDC of 2446822.5 and ends with a JDC of 2446823.4999… Hence, noon is at 2446823.0. The corresponding Julian Day Number (JDN) is at noon, which is 2446823 for the given example (January 27th 1987).

For more information about the Julian Day, see: Jean Meeus, Astronomical Algorithms, 1998, 59pp. and https://en.wikipedia.org/wiki/Julian_day

Please note that this software uses the (astronomical) convention that BCE dates are represented as negative years and that the year zero (0) is used. This means that the year 1 BCE must be given as year 0, and the year 2 BCE corresponds to -1 etc.

Currently, the Gregorian, Julian, and Islamic calendar are supported.

Focus

The focus of this project is to provide a design or architecture that makes it easy to convert between calendars. It is, however, not primarily a library for astronomical algorithms. For now, we put the these methods in the module JDNConvertibleConversionModule. We would like to make this an separate module which could be used with JDNConvertibleCalendar (see https://github.com/dhlab-basel/JDNConvertibleCalendar/issues/1).

Design

JDNConvertibleCalendar is an abstract class that can be implemented for various calendars, provided that those can be converted from and to a Julian Day.

The abstract base class offers a generic way to convert from and to any of its subclasses. Also calculations based on JDN are already implemented in the base class (shifting of a given period to the future or the past).

All dates are treated as periods. This allows for the handling of different precisions.

Adding more Calendars

When adding a new subclass for JDNConvertibleCalendar, calendar specific methods have to be implemented, e.g., the conversion from and to the Julian Day. Calendar specific methods are declared abstract in the base class and have to be implemented when making a subclass. The new subclass has to be added to supportedCalendars (configuration array) and convertCalendar (conversion method) in JDNConvertibleCalendar.

Scientific board

The project is scientifically accompanied by Rita Gautschy (University of Basel). She reviewed the calendar conversion algorithms in JDNConvertibleConversionModule and provided an implementation in Fortran that allows for comparison of the results.

Documentation

See https://dhlab-basel.github.io/JDNConvertibleCalendar/docs/index.html.

The HTML-documentation can also be built locally running npm run builddocs in the project root.

Examples

For working examples, please see the tests in the test directory. Run the test with npm test from the project root.

Known Problems

  • The static configuration of how many months a year has per calendar may not be good enough for other calendars than Gregorian and Julian (lunar calendars). Maybe this has to be made a function that returns the number of months for a given year. This would make transposing by month more complicated.

NPM Package

This project is available as an npm module: https://www.npmjs.com/package/jdnconvertiblecalendar.

Integration in Angular Material

JDNConvertibleCalendar can used with Angular Material (https://material.angular.io). Please see https://github.com/dhlab-basel/JDNConvertibleCalendarDateAdapter for more details.