Skip to content

VERY basic helper to format numeric values and dates to various output formats

Notifications You must be signed in to change notification settings

low-res/formater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

formater

VERY basic formater. Takes a number or date and converts it to a nicely formated string.

The module will return a singleton instance of the Formater.

Usage

var formatedString = Formater.formatValueToType( 1000, "float" );

There are several default formats defined:

  • float (precission 2)
  • float-1 (precision 1)
  • int
  • percent
  • percent-ceil
  • time
  • date
  • currency

i18l

Currently en and de are supportet

Change the locale with:

Formater.setLocale('de');

request the currently set locale with Formater.getLocale();

custom formats

You can also define your own formats. Every format is defined in an object.

Formater.addCustomFormat( "xyz", function( initialValue, currentLocale ){
                                         var formatedValue = initialValue;
                                         return formatedValue;
                                     } );                                      

then use it with:

var formatedString = Formater.formatValueToType( 1000, "xyz" );

About

VERY basic helper to format numeric values and dates to various output formats

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published