Liên hệ

   
## .unitFormatter( unit, options ) ➜ function( value )Returns a function that formats a unit according to the given unit, options, and thedefault/instance locale.The returned function is invoked with one argument: the number `value` tobe formatted.### Parameters**unit**String value indicating the unit to be formatted. eg. "day", "week", "month", etc.Could also be a compound unit, eg. "mile-per-hour" or "mile/hour"**options**- form: [String] eg. "long", "short" or "narrow".- numberFormatter: [Function] a number formatter function. Defaults to Globalize `.numberFormatter()` for the current locale using the default options.**value**The number to be formatted.### ExamplePrior to using any unit methods, you must load `cldr/main/{locale}/units.json` and theCLDR content required by the plural module. Read [CLDR content][] if you needmore information.[CLDR content]: ../../../README.md#2-cldr-contentYou can use the static method `Globalize.unitFormatter()`, which uses the defaultlocale.```javascriptvar customNumberFormatter, formatter;Globalize.locale( "en" );formatter = Globalize.unitFormatter( "month", { form: "long" } );formatter( 1 );// > "1 month"formatter( 3 );// > "3 months"formatter( 3000 );// > "3,000 months"
[ Back ]
Cong ty TNHH An Lac Phat
(AN LAC PHAT CO., LTD.)
C10-14, Carina Plaza, 1648 Vo Van Kiet,
P.16, Q.8, Ho Chi Minh, VIETNAM
Your reliable partner for:
3D Printer
Plastic Blow
Molding Machine
Tel. : (84-28) 6264-6495 - Tel/Fax : (84-28) 6264-6494
Website : www.alpha-3d.com
Email : sales.alpha3d@gmail.com
© Copyright 2010-2014 . All rights reserved.