1.7.0 • Published 1 year ago

nks-number-to-words v1.7.0

Weekly downloads
8
License
MIT
Repository
github
Last release
1 year ago

NumberToWords

Number converter to words

Download

  $ bower install nks-number-to-words;
  $ npm install nks-number-to-words --save;
  $ git clone https://github.com/konstantin-nizhinskiy/NumberToWords;

Location

Now support (ua,ru)

Function

functionsREADME
getConvert numbers
getPriceConvert sum with currency
getDateConvert date

get

Number converter to words (support: 0 ... 999 999 999.9999999)

Arguments

ParamstypeREADME
number{int/string}number
local{string}location

getPrice

Convert sum with currency to words (support: 1 ... 999 999 999.99)

Arguments

ParamstypeREADME
number{int/string}sum
local{string}location
currency{string}currency
options{object}dop property
options.fractional_is_number{boolean}Do not convert fractional amount into words (default:false)

Currency

CurrencyCurrency number
USD840
UAH980
EUR978
RUR810
RUB643
PLZ616
PLN985
GBP826
CHF756
CZK203
CAD124
SEK752
NOK578
JPY392
ILS376
BYN933
KZT398
AUD036
GEL981
UZS860
MDL498
HUF348
CNY156
NZD554
AZN944
INR356
KGS417
DKK208

getDate

Date converter to words

Arguments

ParamstypeREADME
number{string}date
local{string}location

Formats date

Formats
DD.MM.YYYY
DD-MM-YYYY

Example

<script src="dist/numberToWords.min.js"  type="text/javascript"></script>
<script src="dist/translations.ua.js"  type="text/javascript"></script>
<script type="text/javascript">
    console.log(numberToWords.get(123,'ua')); //сто двадцять три
    console.log(numberToWords.get(1,'ua')); //один
            
    console.log('UA getPrice: ',numberToWords.getPrice(23,'ua',"UAH"));//UA getPrice:    двадцять три гривні ноль копійок 
    console.log('UA getPrice 101.01: ',numberToWords.getPrice(101.01,'ua',"UAH"));//UA getPrice 101.01:    сто одна гривня одна копійка
    console.log('UA getPrice 101.11: ',numberToWords.getPrice(101.11,'ua',"UAH"));//UA getPrice 101.11:    сто одна гривня одинадцять копійок
    console.log('UA getPrice 101.20: ',numberToWords.getPrice(101.20,'ua',"UAH"));//UA getPrice 101.20:    сто одна гривня двадцять копійок 
    console.log('UA getPrice 101.21: ',numberToWords.getPrice(101.21,'ua',"UAH"));//UA getPrice 101.21:    сто одна гривня двадцять одна копійка
    console.log('UA getPrice 101.22: ',numberToWords.getPrice(101.22,'ua',"UAH"));//UA getPrice 101.22:    сто одна гривня двадцять двi копійки
    console.log('UA getPrice 102.22: ',numberToWords.getPrice(102.22,'ua',"UAH"));//UA getPrice 102.22:    сто двi гривні двадцять двi копійки
    console.log('UA getPrice 12.22: ',numberToWords.getPrice(12.22,'ua',"UAH"));//UA getPrice 12.22:    дванадцять гривень двадцять двi копійки
    console.log('UA getPrice 101.212: ',numberToWords.getPrice(101.212,'ua',"UAH"));//UA getPrice 101.212:    сто одна гривня 212 копійок
    console.log('UA getPrice 101.01: ',numberToWords.getPrice(101.01,'ua',"UAH",{"fractional_is_number":true})); //UA getPrice 101.01:    сто одна гривня 01 копійка
    console.log('UA getPrice 102: ',numberToWords.getPrice(102,'ua',"UAH"));//UA getPrice 102:    сто двi гривні ноль копійок 
    
    console.log('UA getPrice 101.24: ',numberToWords.getPrice(101.24,'ua',"840"));//UA getPrice 101.24:    сто одна долар двадцять чотири цента 
    console.log('UA getPrice 101.24: ',numberToWords.getPrice(101.24,'ua',"USD"));//UA getPrice 101.24:    сто одна долар двадцять чотири цента 
    
    console.log('UA: ',numberToWords.getDate("22.01.2012",'ua',1));//двадцять другого січня двi тисячі дванадцятого року 
    console.log('UA: ',numberToWords.getDate("22.01.2020",'ua',1));//двадцять другого січня двi тисячі двадцятого року 
    console.log('UA: ',numberToWords.getDate("22.01.2021",'ua',1));//двадцять другого січня двi тисячі двадцять першого року 
    console.log('UA: ',numberToWords.getDate("22.01.2012",'ua',0));//двадцять друге січня двi тисячі дванадцятого року 
    console.log('UA: ',numberToWords.getDate("22.01.2020",'ua',0));//двадцять друге січня двi тисячі двадцятого року 
    console.log('UA: ',numberToWords.getDate("22.01.2021",'ua',0));//двадцять друге січня двi тисячі двадцять першого року 
</script>

Translations

* numberToWords.ru
* numberToWords.ua
1.7.0

1 year ago

1.6.0

1 year ago

1.5.0

2 years ago

1.4.0

3 years ago

1.3.0

3 years ago

1.2.4

3 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.0

4 years ago

1.2.1

4 years ago

1.1.0

5 years ago

0.9.2

6 years ago