bk-ad
Version:
Utility library to convert date in AD to Nepali date BS (Bikram sambat) and vice versa.
62 lines (42 loc) • 987 B
Markdown
# Bikram Sambat
Utility library to convert date in AD (Gregorian) to Nepali date format BS (Bikram sambat) and vice versa.
[](https://www.npmjs.com/package/bk-ad)
[](https://twitter.com/PuncozNepal)
## Installation
Using NPM:
```
npm i bk-ad
```
or, using Yarn:
```
yarn add bk-ad
```
## Usage
### Import package
Using ES6 `import`:
```
import BikramSambat, {ADToBS, BSToAD} from "bk-ad"
```
or, using commonJS `require`
```
const BS = require('bk-ad')
BS.ADToBS("2019-08-25")
```
#### 1. BS to AD conversion
Syntax: `BSToAD(date: string): string`
```
BSToAD("2076-05-08") // "2019-08-25"
```
or,
```
new BikramSambat('2076-05-08', 'BS').toAD()
```
#### 2. AD to BS conversion
Syntax: `ADToBS(date: Date | string): string`
```
ADToBS("2019-08-25") // "2076-05-08"
```
or,
```
new BikramSambat('2019-08-25').toBS()
```