Nodejs Date Serialize serialize_date()

Here you can find the source of serialize_date()

Method Source Code

Date.prototype.serialize_date = function(){
    var month =  (Number(this.getMonth()) + 1);
    if (month.toString().length === 1){
        month = "0" + month.toString();
    }//from   w  w w. j  a va 2  s. c  o m
    var day =  (Number(this.getDate()) + 1);
    if (day.toString().length === 1){
        day = "0" + day.toString();
    }
    return this.getFullYear() + "-" + month + "-" + day;
};

Related

  1. serialize()
    Date.get = function( str ){
      var arr = str.split("-"),
        d = new Date();
      d.setFullYear( arr[0], arr[1] - 1, arr[2] );
      d.setHours(0,0,0,0);
      return d;
    };
    Date.prototype.serialize = function(){
      var m = this.getMonth() + 1;
    ...