diff --git a/smtp/date.js b/smtp/date.js index c0b84c6..52287f1 100644 --- a/smtp/date.js +++ b/smtp/date.js @@ -1,3 +1,8 @@ +/** + * @param {Date} [date] an optional date to convert to RFC2822 format + * @param {boolean} [useUtc=false] whether to parse the date as UTC (default: false) + * @returns {string} the converted date + */ function getRFC2822Date(date = new Date(), useUtc = false) { if (useUtc) { return getRFC2822DateUTC(date); @@ -17,7 +22,11 @@ function getRFC2822Date(date = new Date(), useUtc = false) { return dates.join(' '); } - +/** + * + * @param {Date} [date] an optional date to convert to RFC2822 format (UTC) + * @returns {string} the converted date + */ function getRFC2822DateUTC(date = new Date()) { const dates = date.toUTCString().split(' '); dates.pop(); // remove timezone