Nodejs String Format formatDateBrazil(dateString)

Here you can find the source of formatDateBrazil(dateString)

Method Source Code

// format date to a format that is not affected to brazil's timezone 
String.prototype.formatDateBrazil = function(dateString) {
    var date = dateString.split("T");
    date = date[0].split("-");
    var date = new Date(date[0], (date[1] - 1), date[2]);
    return date;//from ww  w. j  a v  a2  s . c  o  m
};

Related

  1. format(substitutions)
    'use strict';
    String.prototype.format = function(substitutions) {
      return this.replace(/\{([A-Za-z0-9]+)\}/g, function(match, key) {
        return substitutions[key] !== undefined ? substitutions[key] : ''
      })
    
  2. format(substitutions)
    String.prototype.format = function(substitutions) {
        'use strict';
        return this.replace(/\{([A-Za-z0-9]+)\}/g, function(match, key) {
            return substitutions[key] !== undefined ? substitutions[key] : '';
        });
    };
    
  3. format(values)
    var STRING_FORMAT_REGEX = /\{\{([\w\s\.\(\)\'\",-\[\]]+)?\}\}/g;
    String.prototype.format = function(values) {
        return this.replace(STRING_FORMAT_REGEX, function(match, key) {
          return values[key] || eval('(values.' +key+')');
        });
    };
    Date.prototype.format = function(format)
      format = format || "yyyy-MM-dd hh:mm:ss";
    ...
    
  4. format(variables, values)
    String.prototype.format = function (variables, values) {
        var textTemplate = this;
        variables.forEach(function(item, index) {
            var value = values[index];
            if (typeof value === 'undefined' || value == null) {
                value = "";
            textTemplate = textTemplate.replaceAll(item, value);
        });
    ...
    
  5. format2DigitStringformat2DigitString()
    Number.prototype.format2DigitString = function format2DigitString(){
      if(this >= 0 && this < 10) {
        return '0' + String(this);
      return String(this);
    
  6. formatForUrl()
    String.prototype.formatForUrl = function () {
      return this.replace(/ /g, "-").replace(/[^a-z0-9\-]/gi, "").toLowerCase();
    };
    
  7. formatMoney()
    String.prototype.formatMoney = function() {
        return "$" + this.substr(0, this.length - 2) + "." + this.substr(this.length - 2);
    
  8. formatMoney(c, d, t)
    String.prototype.formatMoney = function(c, d, t){
      var n = this, 
      c = isNaN(c = Math.abs(c)) ? 2 : c, 
      d = d == undefined ? "," : d, 
      t = t == undefined ? "." : t, 
      s = n < 0 ? "-" : "", 
      i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", 
      j = (j = i.length) > 3 ? j % 3 : 0;
     return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
    ...
    
  9. formatPV(args)
    String.prototype.formatPV = function(args) {
      if (!args) return this;
      var str = this;
      for (var arg in args) {
        str = str.replace(
          RegExp("\\{\\{" + arg + "\\}\\}", "gi"), args[arg]);
      return str;
    };
    ...