UNPKG

428 BJavaScriptView Raw
1// Copyright 2012 Mark Cavage, Inc. All rights reserved.
2
3'use strict';
4
5/**
6 * Takes an instance of a date object, formats it UTC
7 * e.g., Wed, 17 Jun 2015 01:30:26 GMT
8 *
9 * @public
10 * @function httpDate
11 * @param {Object} now - a date object
12 * @returns {String} formatted dated object
13 */
14module.exports = function httpDate(now) {
15 if (!now) {
16 now = new Date();
17 }
18
19 return now.toUTCString();
20};