kollavarsham js

Installation

The library is implemented in TypeScript on the node.js platform and has been published to the npm (node package manager) registry.

It could be installed as a library module (a dependency) for other node.js applications:

npm install kollavarsham --save

Browserify is a good tool that can generate the library to be used on the client-side (or browser) applications as well:

browserify lib/kollavarsham.js -o bundle.js

It could also be used as a cross-platform command line application (CLI) app using another CLI module (that is essentially a wrapper over the core module), when installed globally like this:

npm install -g kollavarsham

Usage

To use the library in a node.js or a browser app:

// Refer the API docs for accurate semantics

var kollavarsham = require('kollavarsham');
var KollavarshamDate = require('kollavarsham').kollavarshamDate;

var gregorianDate = kollavarsham.toGregorianDate(new KollavarshamDate(1184, 5, 18));  // Not implemented yet

var kollavarshamDate = kollavarsham.fromGregorianDate(new Date(2014, 1, 14));

Current Status

The library is still in a beta state and most of the features are working as expected (a notable exception being the ability to convert a Kollavarsham date into a Gregorian date).

The calendar for instance, is an interactive, AngularJS single page application (source) that gets the Kollavarsham dates from a RESTful service, implemented in NodeJS/ExpressJS (source), using this kollavarsham.js module.

Update

The original JavaScript library was rewritten into TypeScript recently and by using a specialized TypeScript compiler named jsii, it has been converted to be available for other supported languages like Java, .NET and Python. More details on this usage of jsii can be seen on this blog post.

API Documentation

Check out the evolving API documentation that is generated from the source using YUIDoc here: API documentation.

Gratitude

The JavaScript implementation of the Kollavarsham API started off as a port of the Perl implementation of the Pancanga (Hindu Almanac) by M. Fushimi and M. Yano, that is accompanied by a good little write-up with a link to their Perl script as well.

We would like to thank Fushimi-san and Yano-san for their work on the Hindu calendar and for making it open source!

Fork us on GitHub!

Fork us on GitHub and start contributing - kollavarsham-js repository.