Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Use parseDate.
console.log(Globalize.parseDate("1/2/1982"));
// Use parseDate in specific time zones.
console.log(Globalize.parseDate("January 1, 2000 at 12:00:00 AM EST", {
datetime: "long",
timeZone: "America/New_York"
}));
/**
* Number
*/
// Use numberFormatter.
var numberFormatter = Globalize.numberFormatter({minimumFractionDigits: 0, maximumFractionDigits: 10});
console.log(numberFormatter(Math.PI));
// Use formatNumber.
console.log(Globalize.formatNumber(12345.6789));
// Use parseNumber.
console.log(Globalize.parseNumber("12345.6789"));
/**
* Currency
*/
// Use currencyFormatter.
var currencyFormatter = Globalize.currencyFormatter("EUR");
console.log(currencyFormatter(9.99));
var Globalize = require( "globalize" );
var startTime = new Date();
// Standalone table.
var numberFormatter = Globalize.numberFormatter({ maximumFractionDigits: 2 });
document.getElementById( "number" ).textContent = numberFormatter( 12345.6789 );
var numberCompactFormatter = Globalize.numberFormatter({
compact: "short",
minimumSignificantDigits: 1,
maximumSignificantDigits: 3
});
document.getElementById( "number-compact" ).textContent = numberCompactFormatter( 12345.6789 );
var currencyFormatter = Globalize.currencyFormatter( "USD" );
document.getElementById( "currency" ).textContent = currencyFormatter( 69900 );
var dateFormatter = Globalize.dateFormatter({ datetime: "medium" });
document.getElementById( "date" ).textContent = dateFormatter( new Date() );
var dateWithTimeZoneFormatter = Globalize.dateFormatter({
datetime: "full",
timeZone: "America/Sao_Paulo"
});
var Globalize = require( "globalize" );
var startTime = new Date();
// Standalone table.
var numberFormatter = Globalize.numberFormatter({ maximumFractionDigits: 2 });
document.getElementById( "number" ).textContent = numberFormatter( 12345.6789 );
var numberCompactFormatter = Globalize.numberFormatter({
compact: "short",
minimumSignificantDigits: 1,
maximumSignificantDigits: 3
});
document.getElementById( "number-compact" ).textContent = numberCompactFormatter( 12345.6789 );
var currencyFormatter = Globalize.currencyFormatter( "USD" );
document.getElementById( "currency" ).textContent = currencyFormatter( 69900 );
var dateFormatter = Globalize.dateFormatter({ datetime: "medium" });
document.getElementById( "date" ).textContent = dateFormatter( new Date() );
var dateWithTimeZoneFormatter = Globalize.dateFormatter({