nntp-server
Version:
NNTP server implementation.
35 lines (26 loc) • 573 B
JavaScript
// https://tools.ietf.org/html/rfc3977#section-7.1
//
;
const status = require('../status');
// 1 -> 01
function pad2(value) {
return value < 10 ? '0' + value : '' + value;
}
module.exports = {
head: 'DATE',
validate: /^DATE$/i,
pipeline: true,
run() {
let now = new Date();
return [
status._111_DATE,
' ',
now.getUTCFullYear(),
pad2(now.getUTCMonth() + 1),
pad2(now.getUTCDate()),
pad2(now.getUTCHours()),
pad2(now.getUTCMinutes()),
pad2(now.getUTCSeconds())
].join('');
}
};