Skip to content

Commit

Permalink
toJSON should return AD and BS objects
Browse files Browse the repository at this point in the history
  • Loading branch information
twlite committed Jan 8, 2022
1 parent ad97e6d commit 1c4d63b
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Lightweight JavaScript library to convert Nepali and English dates.

[![](https://data.jsdelivr.com/v1/package/npm/datenp/badge?style=rounded)](https://www.jsdelivr.com/package/npm/datenp) [![](https://img.shields.io/npm/dt/datenp.svg)](https://img.shields.io)

# Features

- Lightweight
Expand All @@ -24,6 +26,14 @@ $ npm install datenp
import DateNP from "https://deno.land/x/datenp/mod.ts";
```

## Browsers

```html
<script type="module">
import DateNP from "https://cdn.jsdelivr.net/npm/datenp@latest/dist/mod.mjs";
</script>
```

# Example

## CommonJS
Expand Down
5 changes: 4 additions & 1 deletion deno/DateNP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ export class DateNP {
}

public toJSON() {
return this.toString();
return {
AD: this.toAD(),
BS: this.toBS()
};
}

public valueOf() {
Expand Down
10 changes: 10 additions & 0 deletions deno/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Lightweight JavaScript library to convert Nepali and English dates.

[![](https://data.jsdelivr.com/v1/package/npm/datenp/badge?style=rounded)](https://www.jsdelivr.com/package/npm/datenp) [![](https://img.shields.io/npm/dt/datenp.svg)](https://img.shields.io)

# Features

- Lightweight
Expand All @@ -24,6 +26,14 @@ $ npm install datenp
import DateNP from "https://deno.land/x/datenp/mod.ts";
```

## Browsers

```html
<script type="module">
import DateNP from "https://cdn.jsdelivr.net/npm/datenp@latest/dist/mod.mjs";
</script>
```

# Example

## CommonJS
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "datenp",
"version": "0.1.1",
"version": "0.1.2",
"description": "Lightweight JavaScript library for nepali date conversion",
"main": "dist/mod.js",
"module": "dist/mod.mjs",
Expand Down
5 changes: 4 additions & 1 deletion src/DateNP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ export class DateNP {
}

public toJSON() {
return this.toString();
return {
AD: this.toAD(),
BS: this.toBS()
};
}

public valueOf() {
Expand Down

0 comments on commit 1c4d63b

Please sign in to comment.