Skip to content

Instantly share code, notes, and snippets.

@kauefraga
Last active January 28, 2022 21:30
Show Gist options
  • Save kauefraga/933dcc728a0a043639b3119bb2ec835e to your computer and use it in GitHub Desktop.
Save kauefraga/933dcc728a0a043639b3119bb2ec835e to your computer and use it in GitHub Desktop.
Dynamic clock in bash
import { clear } from 'node:console'
import chalk from 'chalk'
import figlet from 'figlet'
function DynamicClock() {
clear()
const date = {
hours: new Date().getHours(),
minutes: new Date().getMinutes(),
seconds: new Date().getSeconds()
}
console.log(
chalk.green(
figlet.textSync(`${date.hours}:${date.minutes}:${date.seconds}`, { horizontalLayout: 'full' })
)
)
}
setInterval(DynamicClock, 1010)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment