Textual display of millisecond durations and in several languages.
npm install tims
shell
npm install tims@latest
`
Usage
$3
`ts
// Typescript or ESModules
import tims from "tims"
// CommonJS
const tims = require("tims")
`
$3
Use for display uptime in Spanish
`ts
const startedAt = new Date()
function displayUptime() {
const uptimeText = tims.since(startedAt, { locale: "es" })
console.log(uptimeText)
}
`
Methods
$3
Get the sentence of time past since given moment
$3
Get the sentence of time between given moments
$3
Get the sentence of given duration
Options
`ts
interface Options {
format?: "day" | "year" | "month" | "hour" | "minute" | "second" | "ms"
locale?: "fr" | "es" | "en"
full?: boolean
}
``