You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importDataFormatterfrom'excel-style-dataformatter';importrufrom'excel-style-dataformatter/lib/ru';// Create instance with defined localesconstoptions={locales: [ru]};constdataFormatter=newDataFormatter(options);// Switch localedataFormatter.setLocale('ru');constresult=dataFormatter.format('99','Number','Currency');
Browser
<scriptsrc="excel-style-dataformatter/lib/index.js"></script><scriptsrc="excel-style-dataformatter/lib/locales/ru.js"></script><script>// Create instancevardataFormatter=newwindow.DataFormatter({locales: [window.DataFormatter_ru]});// Default localedocument.write(dataFormatter.format('123.44','Number','Currency').value);// Switch to russiandataFormatter.setLocale('ru');document.write(dataFormatter.format('123.44','Number','Currency').value);</script>
AMD
<script>require(['excel-style-dataformatter/lib/index','excel-style-dataformatter/lib/locales/ru'],function(){require(['DataFormatter','DataFormatter_ru'],function(DataFormatter,ru){// Create instancevardataFormatter=newDataFormatter({locales: [ru]});// Default localedocument.write(dataFormatter.format('99','Number','Currency').value);// Switch to russiandataFormatter.setLocale('ru');document.write(dataFormatter.format('99','Number','Currency').value);});});</script>
Available options
locale {string} - default locale
locales {string} - defined locales
UTCOffset {number|null} - UTC offset for dates in minutes
transformCode {function}
debug {boolean}