Nodejs Time Calculate addTime( time )

Here you can find the source of addTime( time )

Method Source Code

// These extentions are required for the interals of cron.js to function.
Date.prototype.addTime = function ( time ) {
  this.setTime( this.getTime() + time );
};
Date.prototype.addMinutes = function ( minutes ) {
  this.setMinutes( this.getMinutes() + minutes )
};
Date.prototype.addHours = function ( hours ) {
  this.setHours( this.getHours() + hours );
};
Date.prototype.addDays = function ( days ) {
  this.setDate( this.getDate() + days );
};
Date.prototype.addMonths = function ( months ) {
  this.setMonth( this.getMonth() + months ); 
};

Date.prototype.addYears = function ( years ) {
  this.setFullYear( this.getFullYear() + years );
}

Array.prototype.uniq = function () {
 for( var i = 0, l = this.length; i < l; i++ ) {
   var value = this[i], at = i + 1;
   while( ( at = this.indexOf( value, at ) ) != -1 ) {
     this.splice( at, 1 ); l--;// www  . ja  v a  2s . c  o m
   };
 };
 return this;
};

Related

  1. color (datetime)
    Array.prototype.forEach.call(document.querySelectorAll('main > ul li'), function (el) {
      el.style.color = color(el.dataset.datetime);
    });
    function color (datetime) {
      if (!datetime) { return; }
      var date = new Date(datetime);
      var ago = (new Date() - date) / (8.64e+7 * 365); 
      var day = Math.ceil((date - new Date(date.getFullYear(), 0, 1)) / 8.64e+7);
      var hue = Math.floor(360 * day / 365);
    ...
    
  2. currentTimeColor()
    Date.prototype.currentTimeColor = function() {
        return "#" + ((this.getHours() < 10)?"0":"") + this.getHours() + ((this.getMinutes() < 10)?"0":"") + this.getMinutes() + ((this.getSeconds() < 10)?"0":"") + this.getSeconds();
    };
    
  3. dateTime()
    Date.prototype.dateTime = function() {
       var yyyy = this.getFullYear().toString();
       var mm = (this.getMonth()+1).toString(); 
       var dd  = this.getDate().toString();
       var hh = this.getHours().toString();
       var min = this.getMinutes().toString();
       var sec = this.getSeconds().toString();
       var time = (hh[1]?hh:"0"+hh[0]) + ":" + (min[1]?min:"0"+min[0]) + ":" + (sec[1]?sec:"0"+sec[0]);
       var date = (dd[1]?dd:"0"+dd[0]) + "/" + (mm[1]?mm:"0"+mm[0]) + "/" + yyyy;
    ...
    
  4. datetime()
    Date.prototype.datetime = function() {
      var y = this.getFullYear();
      var M = this.getMonth() + 1;
      var d = this.getDate();
      var h = this.getHours();
      var m = this.getMinutes();
      var s = this.getSeconds();
      M = M < 10 ? '0' + M : M;
      d = d < 10 ? '0' + d : d;
    ...