<commit_before># [kollavarsham](http://kollavarsham.org/)

[![NPM version][npm-image]][npm-url] [![PyPI version][pypi-image]][pypi-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Dev-Dependency Status][daviddm-dev-image]][daviddm-dev-url] [![Coverage Status][coveralls-image]][coveralls-url]

> Convert Gregorian date to Kollavarsham date and vice versa


## Install

```sh
$ npm install --save kollavarsham
```


## Usage

```js
import { Kollavarsham } from 'kollavarsham';

const options = {
  system: 'SuryaSiddhanta',
  latitude: 10,
  longitude: 76.2
};

const kollavarsham = new Kollavarsham(options);

const todayInMalayalamEra = kollavarsham.fromGregorianDate(new Date());

const today = kollavarsham.toGregorianDate(todayInMalayalamEra);
```


## Documentation

Check out the [Kollavarsham class](https://kollavarsham.org/kollavarsham-js/module-kollavarsham.Kollavarsham.html) within the API documentation as this is the entry point into the library.


## CLI app

Check out the [cli](https://www.npmjs.com/package/kollavarsham-cli) module ([GitHub repo](https://github.com/kollavarsham/cli)) for the `kollavarsham` cross-platform CLI app 

```plain
npm install -g kollavarsham-cli

kollavarsham --help<commit_msg>add python example to the README<commit_after># [kollavarsham](http://kollavarsham.org/)

[![NPM version][npm-image]][npm-url] [![PyPI version][pypi-image]][pypi-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Dev-Dependency Status][daviddm-dev-image]][daviddm-dev-url] [![Coverage Status][coveralls-image]][coveralls-url]

> Convert Gregorian date to Kollavarsham date and vice versa


## Install

```sh
$ npm install --save kollavarsham
```


## Usage

### TypeScript/JavaScript/Node.js

```js
import { Kollavarsham } from 'kollavarsham';

const options = {
  system: 'SuryaSiddhanta',
  latitude: 10,
  longitude: 76.2
};

const kollavarsham = new Kollavarsham(options);

const todayInMalayalamEra = kollavarsham.fromGregorianDate(new Date());

const today = kollavarsham.toGregorianDate(todayInMalayalamEra);
```

### Python

```python
import datetime
import pytz
import kollavarsham

now = pytz.utc.localize(datetime.datetime.utcnow())
kv = kollavarsham.Kollavarsham(latitude=10, longitude=76.2, system="SuryaSiddhanta")

today = kv.from_gregorian_date(date=now)
print(today.year, today.ml_masa_name, today.date, '(' + today.naksatra.ml_malayalam + ')')
```

## Documentation

Check out the [Kollavarsham class](https://kollavarsham.org/kollavarsham-js/module-kollavarsham.Kollavarsham.html) within the API documentation as this is the entry point into the library.


## CLI app

Check out the [cli](https://www.npmjs.com/package/kollavarsham-cli) module ([GitHub repo](https://github.com/kollavarsham/cli)) for the `kollavarsham` cross-platform CLI app 

```plain
npm install -g kollavarsham-cli

kollavarsham --help
{'fraction_non_alphanumeric': 0.14720812182741116, 'fraction_numerical': 0.005076142131979695, 'mean_word_length': 5.842592592592593, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3241511', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1076, 'n_words': 215}