1
0
mirror of https://github.com/eleith/emailjs.git synced 2024-07-03 11:38:50 +00:00

add jsdoc types to date

This commit is contained in:
Zack Schuster 2018-06-28 17:55:06 -07:00
parent 90783a8ca2
commit 069c32b3c9

View File

@ -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