const formatTimes = date => { const year = date.getFullYear() const month = date.getMonth() + 1 const day = date.getDate() const hour = date.getHours() const minute = date.getMinutes() const second = date.getSeconds() return [year, month, day].map(doubleNumber).join('/') + ' ' + [hour, minute, second].map(doubleNumber).join(':') } const doubleNumber = num => { num = num.toString() return num[1] ? num : '0' + num } module.exports = { formatTime: formatTimes }