mirror of
https://github.com/eleith/emailjs.git
synced 2024-07-05 20:10:37 +00:00
add jsdoc types to date
This commit is contained in:
parent
90783a8ca2
commit
069c32b3c9
11
smtp/date.js
11
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
|
||||
|
Loading…
Reference in New Issue
Block a user