Currency conversion and money formating libraries in Javascript

money.js

These are 2 very useful Javascript libraries for dealing with money currency and formatting written by Joss Crowcroft.

Currency conversion with money.js

money.js is a currency conversion library with no dependencies, in just over 1 KB. You could provide your own currency rates in JSON format or use the data from the Open Source Exchange Rates project which is also created by Joss Crowcroft and looks very promising!

Usage examples:

// From any currency, to any currency:
fx.convert(12.99, {from: "GBP", to: "HKD"});

// Chaining:
fx(1000).from("USD").to("GBP");
fx(1000).to("AED");

// With simple settings and defaults, making this possible:
fx.convert(5318008);
fx(5318008).to("AED");

Money formatting with accounting.js

accounting.js is a small library for number, money and currency formatting, with optional excel-style column rendering (to line up symbols and decimals). It's lightweight, fully localisable and has no dependencies.

I've been using accounting.js for a month -in the administration panel of an e-commerce system- and had zero problems so far.

Usage examples:

// Default usage:
accounting.formatMoney(12345678); // $12,345,678.00

// European formatting (custom symbol and separators), could also use options object as second param:
accounting.formatMoney(4999.99, "€", 2, ".", ","); // €4.999,99

// Negative values are formatted nicely, too:
accounting.formatMoney(-500000, "£ ", 0); // £ -500,000

// Simple `format` string allows control of symbol position [%v = value, %s = symbol]:
accounting.formatMoney(5318008, { symbol: "GBP",  format: "%v %s" }); // 5,318,008.00 GBP

// Formatting numbers
accounting.formatNumber(5318008); // 5,318,008
accounting.formatNumber(9876543.21, 3, " "); // 9 876 543.210

// Unformatting numbers / currency strings
accounting.unformat("£ 12,345,678.90 GBP"); // 12345678.9

Comments

Jason  •  March 6, 2013 03:49

accounting.formatMoney(4999.99, "€", 2, ".", ","); // €4.999,99 -> this is useless.

Fredy  •  October 4, 2013 12:07

@Jason
I think you do not see the big picture

if you replace the 4999.99 by a variable then this function is very useful

Ermir  •  April 28, 2014 13:42

Hey thanks for this great information :) Was a pleasure reading it :)

obat perangsang wanita  •  June 24, 2014 12:00

wanita sedikit bingung disaat hubungan seksualnya sudah berkurang maka dari itu mereka takut jika pasangannya berpaling darinya oleh karena itu ini saat yang tepat dan cepat membangkitkan libido dengan obat perangsang wanita herbal alami dan sangat aman.

sara  •  November 3, 2014 08:13

Forex trading is open 24 hours a day and therefore you need to ensure that the forex broker that you choose operates at all times of the day. 

Forex Trading Platform

ace maxs  •  December 10, 2014 09:56

thanks for sharing mr

Portal Medan  •  December 26, 2014 17:00

This is an excellent post I seen thanks to share it. It is really what I wanted to see hope in future you will continue for sharing such a excellent post.
http://www.caramakan.com | http://wahyublahe.com | http://merdekawalk.com | http://www.ceritamedan.com | http://www.22jerseybola.com | http://ceritamedan.blogdetik.com | http://inimedan.com | http://nasutionrizky.com | http://tamvanseo.blogspot.com | http://medanheritage.com | http://wahyublahe.blogspot.com | http://www.ceritamedan.com/2014/09/Pancake-Durian.html

http://goo.gl/SvFXl4 Social Media Buzzer | http://goo.gl/OgqOHo Cara Membuat Paspor Online | http://goo.gl/KGDkqN Manfaat Mandi Pagi | http://goo.gl/qYsBRi Cara Cek Nomor HP | http://goo.gl/l7uCgL Jasa SEO Medan | http://goo.gl/kFlME0 Cara Pakai Tongsis | http://goo.gl/O43aib Gaya Pacaran Anak Muda | http://goo.gl/1s6xwm Desain Kamar Tidur Anak Perempuan |

http://goo.gl/pAO4gM Cara Menurunkan Berat Badan | http://goo.gl/sfA5RT Foto Selfie | http://goo.gl/YVD20z Cara Menulis Cerita Fiksi | http://goo.gl/IMYXbC Manfaat Air Putih | http://goo.gl/kVbVxJ Parfum Pria | http://goo.gl/KGMUVR Kunci Jawaban Tebak Gambar | http://goo.gl/Dyh1zw Wisata Medan | http://goo.gl/wsViV0 Transportasi Medan | http://goo.gl/HuKSTI Pelaruga | http://goo.gl/uNLn51 Kuliner Medan | http://goo.gl/OKb0IJ Komunitas Medan | http://goo.gl/k1vK9X Berita Komunitas | http://goo.gl/98iCdo Oleh Oleh Khas Medan |
http://goo.gl/kWYmnK | http://goo.gl/ATnmhV Toko Roti di Medan | http://goo.gl/51UapI Cara Menjadi Barista | http://goo.gl/nurVHd Cara Menjadi Kaya | http://goo.gl/3LeXRA Cara Menjadi Model | http://goo.gl/4FQYi9 Cara Menjadi Ibu yang Baik | http://goo.gl/EqsY7i Tips Menjadi Penulis Hebat | http://goo.gl/3nJnZl Kopi Medan | http://goo.gl/4VQsNE Pulau Siba | http://goo.gl/Ey8A2h Daftar Film Bioskop Terbaru 2015 | http://goo.gl/MYEkbd Gaya Foto Prewedding

agen tiket pesawat  •  January 12, 2015 07:15

many thanks for share this

bisnis tiket pesawat  •  January 12, 2015 07:15

makasih atas info yang sangat menarik ini

usaha tiket pesawat  •  January 12, 2015 07:15

wow excellent content

dongdong32  •  January 23, 2015 16:41

http://lululemon.suleymanaltun.com
http://toms.raleighdowntowner.co
http://www.marc--jacobs.com
http://concord11.sellittodaywithebay.com
http://raybanwayfarer.thedailysabs.com
http://www.ralph-laurenoutlet.com.co
http://www.canadagoosejackets.name
http://www.lebronjames-shoes.net
http://www.louisvuittonhandbags.net.co
http://oakleysunglassescheap.oakleywebsite.net
http://christianlouboutinoutlet.maximumguarantee.com
http://www.jordan11.name
http://raybansunglasses.thedailysabs.com
http://www.lebronjames-shoes.name
http://www.fitflop-shoes.us
http://www.louis--vuitton.us
http://www.insanityworkout.com.co
http://truereligion.onlineinc.net.co
http://www.ugg-boots.eu.com
http://www.supra-shoes.cc
http://www.michaelkorshandbags.eu.com
http://knockoffwatches.freebirdspublishing.com
http://raybans.thedailysabs.com
http://www.ugg-boots.com.co
http://canadagoosejackets.pensacolacandles.com
http://www.toryburch-outletonline.com.co
http://www.ugg-boots.in.net
http://christianlouboutin.maximumguarantee.com
http://www.prada-outlet.us
http://oakleysunglasses.oakleywebsite.net
http://www.timberlandboots.cc
http://www.retrojordans.name
http://www.abercrombiekids.name
http://www.tory-burchoutlet.in.net
http://www.cheap-jordans.us.com
http://www.christian-louboutinoutlet.com.co
http://www.coach-outlet.us.com
http://www.celine-outlet.us
http://burberryoutlet.newestsite.net
http://www.hollisterkids.net
http://todsoutletstore.kingmancommercialrealestate.com
http://www.abercrombieandfitch.net.co
http://cheapoakleys.oakleywebsite.net
http://rayban.letterpresskids.com
http://www.polo-ralphlauren.net.co
http://www.louisvuitton-lvoutlet.com
http://tomswedges.raleighdowntowner.co
http://www.oakleysunglassescheap.name
http://www.truereligion.eu.com
http://www.louisvuittonoutlet.net.co

www.scorespro.com  •  January 28, 2015 06:17

All of us present the overall divisibility rule for any Divisor the industry prime quantity and put it on to particular cases. The reason is articulate and simple to follow, realize and utilize. www.scorespro.com

cara mengobati ambeien  •  February 14, 2015 03:02

Agan, how in order to be accepted in adsanse

ask for help :)

22x  •  February 28, 2015 09:38

11a 11s 11d 11f 11g 11h 11j 11k 11l 11z

22x 22c 22v 22b 22n 22m 22p 22o 22u 22y 22e

33h 33j 33k 33g 33f 33d 33s 33a 33t 33w 33q

cheap,jordans 4 black cat  •  March 7, 2015 02:58


[url=http://www.airjordan4.uk.com/]air jordan,air jordan 4,air jordan uk,air jordan 4 retro,air jordan cheap,jordans 4 black cat[/url]
[url=http://www.airjordan4.uk.com/air-jordan-3-retro-c-9.html]air jordan 3 uk,air jordan sale,air jordan 3 retro,men's air jordan 3[/url]
[url=http://www.airjordan4.uk.com/air-jordan-6-retro-c-3.html]air jordan 6 uk,air jordan 6 womens,air jordan 6 mens,air jordan 6 retro[/url]
[url=http://www.airjordan4.uk.com/nike-air-yeezy-2-c-7.html]cheap nike air yeezy 2,air yeezy 2 sale,air yeezy 2 uk,air yeezy 2 mens[/url]
[url=http://www.airjordan11.uk.com/]air jordan 11,air jordan 11 uk,air jordan 11 cheap,air jordan 11 low,air jordan 11 sale[/url]
[url=http://www.airjordan11.uk.com/air-jordan-5-retro-c-19.html]air jordan 5 retro uk,cheap air jordan 5,air jordan 5 sale[/url]
[url=http://www.nikefreerun.me.uk/]nike free run,nike free run sale,cheap nike free run,womens nike free run[/url]
[url=http://www.nikefreerun.me.uk/nike-dunk-sky-high-womens-c-5.html]nike dunk sky high uk,nike dunk sky high womens,nike dunk sky high,nike dunk sky high wedge[/url]
[url=http://www.nikefreerun.me.uk/nike-revolution-sky-hi-womens-c-15.html]nike revolution sky hi,nike revolution sky hi wedge,nike revolution sky hi uk,nike revolution sky hi city pack[/url]
[url=http://www.newbalance996.co.uk/]new balance,cheap new balance,new balance 996,new balance 996 women,new balance 996 sale,new balance uk[/url]
[url=http://www.newbalance996.co.uk/asics-mens-c-4.html]asics gel kinsei 4,asics gel kinsei 5,asics gel kinsei 5 womens,asics gel kinsei 5 mens,asics gel sale[/url]

cara pemesanan ace maxs  •  March 9, 2015 10:43

thank your share :)

girlsdoporn  •  March 14, 2015 13:46

What a good blog you have here. Please update it more often. This topics is my interest. Thank you. . .

buy facebook likes  •  March 19, 2015 07:53

Thanks very much for this great article;this is the stuff that keeps me going through out these day.

buying facebook likes  •  March 19, 2015 07:54

Should there be another persuasive post you can share next time, I’ll be surely waiting for it.

http://www.aspiremotoring.com/  •  March 19, 2015 13:53

Very informative post! There is a lot of information here that can help any business get started with a successful social networking campaign!

buy cheap facebook page likes  •  March 19, 2015 15:23

Thanks for writing such a good article, I stumbled onto your blog and read a few post. I like your style of writing...
buy cheap facebook page likes

mattress reviews 2014  •  March 20, 2015 08:43

Yes, great US Military force. Also, in his post you have given a chance to listen about US Military. I really appreciate your work. Thanks for sharing it.

best mattress for side sleepers  •  March 20, 2015 09:20

I was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post.

SEO  •  March 21, 2015 16:27

I also benefit from learning the assessments, but learn that alot of people ought to stay on essay to try and add worth in the direction of the authentic weblog release.

jual topi online  •  March 23, 2015 09:51

nice sharing dude , i love you

jual sepatu online  •  March 23, 2015 09:52

nice sharing brotha thanks for it

sweater pria  •  March 23, 2015 09:52

great sharing and thanks

jual tas laptop  •  March 23, 2015 09:53

thanks for sharing this brotha i just can say it

tas ransel pria terbaru  •  March 23, 2015 09:55

a great website with the good articel

jual ikat pinggang kulit  •  March 23, 2015 09:55

wow awesome articel you has made

jual kemeja pria  •  March 23, 2015 09:55

this is great articel , i like it

celana jeans pria  •  March 23, 2015 09:56

this is great articel to read

jual celana pantai murah  •  March 23, 2015 09:56

thanks for this share

jam tangan pria  •  March 23, 2015 09:57

All of us present the overall divisibility rule for any Divisor the industry prime quantity and put it on to particular cases. The reason is articulate and simple to follow, realize and utilize

usaha tiket pesawat  •  March 23, 2015 09:57

awesome , this is very awesome post

bisnis tiket pesawat  •  March 23, 2015 09:58

i really appreciate this articel thanks

agen tiket pesawat  •  March 23, 2015 09:58

thanks for informative share i was inspiring

jasa seo  •  March 23, 2015 09:59

thanks i read yur blog while at home i do my homework

jasa seo profesional  •  March 23, 2015 09:59

Should there be another persuasive post you can share next time, I’ll be surely waiting for it.

pakar seo  •  March 23, 2015 10:00

thanks alot

jual tas laptop  •  March 23, 2015 10:00

this is awesome post i ever read

dress wanita terbaru  •  March 23, 2015 10:01

great sharing backlash i really like your site

tas wanita terbaru  •  March 23, 2015 10:01

thanks for share this , i appreciate this

isabisformulae.com  •  March 24, 2015 10:25

Thanks for writing such a good article, I stumbled onto your blog and read a few post. I like your style of writing...

CT Personal Injury Attorney  •  March 24, 2015 15:31

You have raised an important issue..Thanks for sharing..I would like to read more current affairs from this blog..keep posting..

purchase facebook likes cheap  •  March 26, 2015 14:29

Should there be another persuasive post you can share next time, I’ll be surely waiting for it.

Victorino Noval  •  March 28, 2015 15:24

I definitely enjoying every little bit of it. It is a great website and nice share. I want to thank you. Good job! You guys do a great blog, and have some great contents. Keep up the good work.

Clash of Clans Astuce  •  March 31, 2015 09:15

I came onto your blog while focusing just slightly submits. Nice strategy for next, I will be bookmarking at once seize your complete rises
Clash of Clans Astuce

Post your comment

(optional)
(optional, will not be shown)
NOTE: Any links will have rel="nofollow"

back