rafaelmaeuer
2/16/2017 - 9:24 AM

Add leading zeros to a value (zerofill) - From http://stackoverflow.com/questions/1267283/how-can-i-create-a-zerofilled-value-using-javascri

function zeroFill( number, width )
{
  width -= number.toString().length;
  if ( width > 0 )
  {
    return new Array( width + (/\./.test( number ) ? 2 : 1) ).join( '0' ) + number;
  }
  return number + ""; // always return a string
}