Created
November 12, 2016 19:07
-
-
Save smks/7877e466262574b34ddbdf8a0da0d147 to your computer and use it in GitHub Desktop.
Features of the Intl API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Number Formatter | |
var communityPoints = 35000000.00; | |
var ukFormatter = new Intl.NumberFormat('en-uk'); | |
var formattedNumber = ukFormatter.format(communityPoints); | |
console.log(formattedNumber); | |
// Currency formatter | |
var houseMaterialCosts = 120457.46; | |
var currencyFormatter = new Intl.NumberFormat('en-GB', { style: 'currency', currency: 'GBP' }); | |
var formattedCosts = currencyFormatter.format(houseMaterialCosts); | |
console.log(formattedCosts); | |
// Date formatter | |
var dateNow = new Date('September 18, 2020 00:00:00'); | |
var dateFormatter = new Intl.DateTimeFormat("en-uk"); | |
var formattedDate = dateFormatter.format(dateNow); | |
console.log(formattedDate); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment