npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

time-plant

v1.0.7

Published

时间戳、字符串、标准时间的相互转换和获取时间

Readme

time-plant

轻量、强大的时间工厂 格式化时间和获取时间

例子:

import {convertTime} from 'time-plant'

convertTime.timestamp(时间戳)
         -> 20181010101010

convertTime.restoreStringDate('20181010101000', 100)
         -> Wed Oct 10 2018 10:10:00 GMT+0800 (中国标准时间)

方法说明

convertTime

splitDate(Date格式, type = 1, symbol(年月日连接符), sfSymbol(时分秒连接符))
    symbol默认为    -
    sfSymbol默认为  :

    type            返回
        -> 1        年月日时分秒(20181010101010)
        -> 2        年月日(2018-10-10) 
        -> 3        年月日时分秒(默认2018-10-10 10:10格式)
        -> 4        年月日(20181010)
        -> 5        月日(1010)
        -> 6        日(10)
        -> 7        时分秒(101010)
        -> 8        时分(1010)
        -> 9        时(10)
        -> 10       分秒(1010)
        -> 11       分(10)
        -> 12       秒(10)
        -> 13       时分秒(10:10:10) 
        -> 14       时分(10:10) 
        -> 15       年月日时分秒(默认2018-10-10 10:10:10格式)
        -> 100      Date格式


timestamp(时间戳, type = 100, symbol(年月日连接符), sfSymbol(时分秒连接符))
    type -> 传参对应的返回值和splitDate一致


restoreStringDate(时间字符串(20181010101010), type = 1)
    type -> 传参对应的返回值和splitDate一致

    说明
        字符串(20181010101000)还原成想要的时间格式


restoreJointTime(时间段(月日/日), type = 100)
    type            返回
        -> 1        Date格式
        -> 2        Date格式

    说明
        还原特殊的时间段成new data,以当前时间为拼接
        0806 (对应type = 1)  -> Date格式
        06   (对应type = 2)  -> Date格式


assignTime(assignNum)
    sonsole.log(convertTime.assignTime(0)) =>   当天的Data格式
    sonsole.log(convertTime.assignTime(1)) =>   明天的Data格式
    sonsole.log(convertTime.assignTime(-1)) =>  昨天的Data格式

    说明
        获取距离当天的指定日期

monthStartTime()
    说明
        获得本月的开始日期data格式

转换成es5语法(babel)

npm install

npm run build

得到的list就是转成功的文件

npm 使用

1. npm login      登录

2. npm publish    更新

3. npm unpublish  包名 --force   撤销更新