Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/twlite/datenp
Lightweight JavaScript library to convert Nepali and English dates
https://github.com/twlite/datenp
api date javascript nepali nepali-calendar nepali-date-conversion nepali-date-converter typescript
Last synced: about 1 month ago
JSON representation
Lightweight JavaScript library to convert Nepali and English dates
- Host: GitHub
- URL: https://github.com/twlite/datenp
- Owner: twlite
- License: mit
- Created: 2022-01-06T16:14:46.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-08T19:41:52.000Z (almost 3 years ago)
- Last Synced: 2024-10-07T18:38:27.277Z (about 1 month ago)
- Topics: api, date, javascript, nepali, nepali-calendar, nepali-date-conversion, nepali-date-converter, typescript
- Language: TypeScript
- Homepage: https://doc.deno.land/https://deno.land/x/datenp/mod.ts
- Size: 82 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DateNP
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
- Zero dependencies
- Supports date conversion from `1975` BS to `2100` BS
- Easy to use
- Beginner friendly# Installation
## Node
```sh
$ npm install datenp
```## Deno
```ts
import DateNP from "https://deno.land/x/datenp/mod.ts";
```## Browsers
```html
import DateNP from "https://cdn.jsdelivr.net/npm/datenp@latest/dist/mod.mjs";
```
# Example
## CommonJS
```js
const { DateNP } = require("datenp");
```## AD to BS
```js
import DateNP from "datenp"const np = new DateNP(new Date("2022-01-06"));
console.log(np.toBS()); // { year: 2078, month: 9, day: 22 }
```## BS to AD
```js
import DateNP from "datenp"const np = new DateNP("2078-09-22");
console.log(np.toAD()); // { year: 2022, month: 1, day: 6 }
console.log(np.getMonthName()); // "Poush"
```## Created and maintained by [DevAndromeda](https://github.com/DevAndromeda)
Under **MIT** License