最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to specify Date object in jsdoc function parameter? - Stack Overflow

programmeradmin3浏览0评论
/**
 * 
 * @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 remended way of specifying the Date type in params list.

/**
 * 
 * @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 remended way of specifying the Date type in params list.

Share Improve this question edited Jul 31, 2020 at 23:36 suchcodemuchwow asked Jul 31, 2020 at 20:44 suchcodemuchwowsuchcodemuchwow 1,0562 gold badges13 silver badges31 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 16

I wrote it like this

/**
 *  @param {Date} date - input date
 */
发布评论

评论列表(0)

  1. 暂无评论