Last active
January 28, 2022 21:30
-
-
Save kauefraga/933dcc728a0a043639b3119bb2ec835e to your computer and use it in GitHub Desktop.
Dynamic clock in bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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