Nodejs Date Value Check isToday()

Here you can find the source of isToday()

Method Source Code

Date.prototype.isToday = function(){
  const today = new Date();
  return this.getYear() === today.getYear() &&
    this.getMonth() === today.getMonth() &&
    this.getDate() === today.getDate();/* ww w . ja v  a 2  s. c o m*/
};

Related

  1. isToDay()
    Date.prototype.isToDay =function(){
        var today = new Date();
        return today.toDateString() == this.toDateString();
    };
    
  2. isToday()
    Date.prototype.isToday = function() {
      return this.toLocaleDateString() === new Date().toLocaleDateString();
    
  3. isToday()
    Date.prototype.isToday = function() {
        var today = new Date();
        return today.getYear() == this.getYear()
                && today.getMonth() == this.getMonth()
                && today.getDate() == this.getDate();
    };
    
  4. isToday()
    Date.prototype.isToday = function() {
        var today = new Date();
        return (today.getFullYear() == this.getFullYear() && today.getMonth() == this.getMonth() && today.getDate() == this.getDate());
    };
    
  5. isValid()
    Date.prototype.isValid = function() {
      return this.getTime() === this.getTime();
    };
    function twoDigits(value) {
      if (value < 10) {
        return '0' + value;
      return value;
    exports.getMyDate = function(timestamp) {
      var date = new Date(timestamp * 1000);
      return date.getFullYear()
        + '-' + date.getMonth()
        + '-' + date.getDate();
    exports.time = function() {
      var date = new Date();
      return date.valueOf() / 1000;