【文件属性】:
文件名称:time-descriptor:JavaScript的时间实用程序
文件大小:65KB
文件格式:ZIP
更新时间:2021-04-07 01:47:38
JavaScript
时间描述符
该软件包旨在更好地可视化相对时间声明。
import { MINUTES , SECONDS , inDays } from "time-descriptor" ;
const start = Date . now ( ) ;
setInterval ( ( ) => {
// Days running
console . log ( inDays ( Date . now ( ) - start ) ) ;
} , 3 * MINUTES + 25 * SECONDS ) ;
设置
从npm获取软件包并将其添加到package.json中。
yarn add time - descriptor
或者,如果您更喜欢npm方式
npm install -- save time - descriptor
用例
该程序包处理相对时间。 它并不打算替代 。 如果您有复杂的
【文件预览】:
time-descriptor-main
----.gitignore(27B)
----package.json(918B)
----src()
--------time.js(1KB)
--------index.js(27B)
----jest.config.js(228B)
----README.md(1KB)
----tests()
--------time.spec.js(2KB)
----yarn.lock(156KB)