UNPKG

onix-core

Version:
15 lines 876 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.dateToUTCString = void 0; const valueToTwoDigits = function (value) { return ((value < 10) ? '0' : '') + value.toString(); }; // ===================== Date ======================== const days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; const dateToUTCString = (date) => { const time = valueToTwoDigits(date.getUTCHours()) + ':' + valueToTwoDigits(date.getUTCMinutes()) + ':' + valueToTwoDigits(date.getUTCSeconds()); return days[date.getUTCDay()] + ', ' + valueToTwoDigits(date.getUTCDate()) + ' ' + months[date.getUTCMonth()] + ' ' + date.getUTCFullYear() + ' ' + time + ' GMT'; }; exports.dateToUTCString = dateToUTCString; //# sourceMappingURL=DateToUTCString.js.map