Skip to content

Commit

Permalink
fix the export of 'Kollavarsham' module
Browse files Browse the repository at this point in the history
  • Loading branch information
floydpink committed Feb 14, 2020
1 parent c1ce9f6 commit 22cbc5a
Show file tree
Hide file tree
Showing 6 changed files with 848 additions and 344 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,19 @@ $ npm install --save kollavarsham
## Usage

```js
var Kollavarsham = require('kollavarsham');
import { Kollavarsham } from 'kollavarsham';

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

var kollavarsham = new Kollavarsham(options);
const kollavarsham = new Kollavarsham(options);

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

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


Expand Down
28 changes: 19 additions & 9 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import { KollavarshamDate } from './dates/kollavarshamDate';
import { SakaDate } from './dates/sakaDate';

export interface Settings {
system: string;
latitude: number;
longitude: number;
readonly system: string;
readonly latitude: number;
readonly longitude: number;
}

/**
Expand Down Expand Up @@ -47,7 +47,7 @@ export interface Settings {
*let today = kollavarsham.toGregorianDate(todayInMalayalamEra); // Not implemented yet
*```
*/
class Kollavarsham {
export class Kollavarsham {
settings: Settings;

/**
Expand Down Expand Up @@ -138,7 +138,11 @@ class Kollavarsham {
* ```
*/
setSystem(system: string): void {
this.settings.system = system;
this.settings = {
system,
latitude : this.settings.latitude,
longitude : this.settings.longitude,
};
}

/**
Expand All @@ -155,7 +159,11 @@ class Kollavarsham {
* ```
*/
setLatitude(latitude: number): void {
this.settings.latitude = latitude;
this.settings = {
system : this.settings.system,
latitude,
longitude : this.settings.longitude,
};
}

/**
Expand All @@ -172,7 +180,11 @@ class Kollavarsham {
*```
*/
setLongitude(longitude: number): void {
this.settings.longitude = longitude;
this.settings = {
system : this.settings.system,
latitude : this.settings.latitude,
longitude,
};
}

/**
Expand Down Expand Up @@ -237,5 +249,3 @@ class Kollavarsham {

Kollavarsham.KollavarshamDate = KollavarshamDate;
Kollavarsham.SakaDate = SakaDate;

export default Kollavarsham;
Loading

0 comments on commit 22cbc5a

Please sign in to comment.