function getRFC2822Date(date = new Date(), useUtc = false) {
	if (useUtc) {
		return getRFC2822DateUTC(date);
	}

	const dates = date
		.toString()
		.replace('GMT', '')
		.replace(/\s\(.*\)$/, '')
		.split(' ');

	dates[0] = dates[0] + ',';

	const day = dates[1];
	dates[1] = dates[2];
	dates[2] = day;

	return dates.join(' ');
}

function getRFC2822DateUTC(date = new Date()) {
	const dates = date.toUTCString().split(' ');
	dates.pop(); // remove timezone
	dates.push('+0000');
	return dates.join(' ');
}

exports.getRFC2822Date = getRFC2822Date;
exports.getRFC2822DateUTC = getRFC2822DateUTC;

@@ -1,28 +1,231 @@
+/**%0A * @param %7BDate%7D %5Bdate%5D an optional date to convert to RFC2822 format%0A * @param %7Bboolean%7D %5BuseUtc=false%5D whether to parse the date as UTC (default: false)%0A * @returns %7Bstring%7D the converted date%0A */%0A
 function getRFC2822Date(date
@@ -529,16 +529,142 @@
 ' ');%0A%7D%0A
+/**%0A *%0A * @param %7BDate%7D %5Bdate%5D an optional date to convert to RFC2822 format (UTC)%0A * @returns %7Bstring%7D the converted date%0A */
 %0Afunctio

add jsdoc types to date