Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify Date object in jsdoc function parameter?

/**
 * 
 * @param {?} date 
 */
function diffDays (date){

  var utcThis = Date.UTC(this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds(), this.getMilliseconds());
  var utcOther = Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());

  return (utcThis - utcOther) / 86400000;
};

I couldn't find any documentation about built-in Date object in jsdoc docs. What is the recommended way of specifying the Date type in params list.

like image 734
Batu G. Avatar asked Jul 31 '20 20:07

Batu G.


Video Answer


1 Answers

I wrote it like this

/**
 *  @param {Date} date - input date
 */
like image 153
hyperzlib Avatar answered Oct 23 '22 15:10

hyperzlib