https://github.com/nxame/nepalinumbers
A JavaScript utility to convert English integers into Nepali integers and useful strings with week and month names in the Nepali locale.
https://github.com/nxame/nepalinumbers
converter devanagari javascript-utility nepali nepali-integers nepali-unicode
Last synced: about 1 month ago
JSON representation
A JavaScript utility to convert English integers into Nepali integers and useful strings with week and month names in the Nepali locale.
- Host: GitHub
- URL: https://github.com/nxame/nepalinumbers
- Owner: nxame
- License: mit
- Created: 2015-09-25T14:04:35.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2026-02-12T03:42:14.000Z (4 months ago)
- Last Synced: 2026-02-12T13:33:43.149Z (4 months ago)
- Topics: converter, devanagari, javascript-utility, nepali, nepali-integers, nepali-unicode
- Language: JavaScript
- Homepage: https://www.danfebooks.com/en/blog/a-java-script-utility-to-easily-convert-string-to-nepali-locale
- Size: 705 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nepalinumbers
A JavaScript utility to convert English integers into Nepali integers and useful strings with week and month names in the Nepali locale.
Bonus: Converts month and week numbers into Nepali Unicode names.
## Why?
So that you don't need third-party API integration like Google Translation just to convert a few strings. Makes life easier and app lighter.
[](https://badge.fury.io/js/%40danfebooks%2Fnepalinumbers)
## What it doesn't do
It doesn't convert dates or numbers from AD to BS or vice-versa;
## How To
```
// Install the package:
`npm i -S @danfebooks/nepalinumbers;`
//Then follow the below examples,
import nepalinumbers from '@danfebooks/nepalinumbers';
// or, import only selected modules
import { week, month } from '@danfebooks/nepalinumbers';
const yearToConvert = 2019;
const convertedYear = nepalinumbers.numbers(yearToConvert);
// => २०१९
const numberToConvert = 35476865;
const convertedNumber = nepalinumbers.numbers(numberToConvert);
// => ३५४७६८६५
const monthToConvert = 12;
const convertedMonth = nepalinumbers.month(monthToConvert);
// => चैत
const weekToConvert = 2;
const convertedWeek = nepalinumbers.week(weekToConvert);
// => सोमबार
```
## Pre-requisite
Babel or any ES6 Transpiler or Webpack within your App. The browser version of minified JS is coming soon!
## Methods
| Method | Options | Description |
|---|---|---|
| month | 'all' or Integer | Translate/Converts month number to Nepali Unicode |
| week | 'all' or Integer | Translate/Converts week number to Nepali Unicode |
| numbers | n/a | Transforms/Converts numbers to Nepali Unicode |
## Examples
```
const nepaliMonths = nepalinumbers.month('all');
// => ['बैशाख','जेठ','असार','साउन','भदौ','असोज','कार्तिक','मङि्सर','पुष','माघ','फागुन','चैत']
```
```
const nepaliWeeks = nepalinumbers.week('all');
// => ['आइतबार','सोमबार','मङ्गलबार','बुधबार','बिहिबार','शुक्रबार','शनिबार']
```