简体   繁体   English

如何在jsdoc function参数中指定日期object?

[英]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.我在 jsdoc 文档中找不到有关内置 Date object 的任何文档。 What is the recommended way of specifying the Date type in params list.在参数列表中指定日期类型的推荐方法是什么。

I wrote it like this我是这样写的

/**
 *  @param {Date} date - input date
 */

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM