Skip to content

Commit

Permalink
Typo
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Aug 6, 2024
1 parent 46cc657 commit 1003564
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions human-formatter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ const LABELS = {

const COLORS = ['red', 'green', 'yellow', 'blue', 'magenta', 'cyan']

function formatTime(date) {
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hour = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0')
function formatNow() {
let date = new Date()
let year = date.getFullYear()
let month = String(date.getMonth() + 1).padStart(2, '0')
let day = String(date.getDate()).padStart(2, '0')
let hour = String(date.getHours()).padStart(2, '0')
let minutes = String(date.getMinutes()).padStart(2, '0')
let seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}-${month}-${day} ${hour}:${minutes}:${seconds}`
}

Expand All @@ -56,7 +57,7 @@ function rightPag(str, length) {

function label(c, type, color, labelBg, labelText, message) {
let pagged = rightPag(c[labelBg](c[labelText](type)), 8)
let time = c.dim(`at ${yyyymmdd.withTime(new Date())}`)
let time = c.dim(`at ${formatNow()}`)
let highlighted = message.replace(/`([^`]+)`/g, c.yellow('$1'))
return `${pagged}${c.bold(c[color](highlighted))} ${time}`
}
Expand Down

0 comments on commit 1003564

Please sign in to comment.