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 🙏

© 2025 – Pkg Stats / Ryan Hefner

jfdate

v1.0.1

Published

**安装**

Readme

jfdate

安装

npm i jfdate --save

api

  • getWeek 获取日期对应的星期几 参数(dateString) dateString 类型:字符串 如:'2012-09-08' 返回类型 字符串 如:'周一'

  • format 格式化日期 参数(date, fmt) date 类型:Date类型 fmt 类型:字符串 如:'yyyy-MM-dd'

  • getSection 获取两个日期的区间的所有日期 参数(day1, day2) day1 类型:字符串 如: '2012-09-08' day2 类型:字符串 如: '2012-09-24' 返回数组 如:

[
   "2021-03-01",
   "2021-03-02",
   "2021-03-03",
   "2021-03-04",
   "2021-03-05",
   "2021-03-06",
   "2021-03-07",
   "2021-03-08",
   "2021-03-09",
   "2021-03-10",
   "2021-03-11",
   "2021-03-12",
   "2021-03-13",
   "2021-03-14",
   "2021-03-15"
]
  • getEndDate 获取当前时间第二天开始的n天后的日期 比如当前是2012-01-01 返回['2012-01-02', '2012-01-13'] 参数(dayCount) dayCount 类型:整数 如: 12 返回数组 ['2012-01-02', '2012-01-13']

  • getDateList 参数(dayCount) dayCount 类型:整数 如: 12 返回数组 如:

[
    {
        "date":"2021-03-01",
        "week":"周一"
    },
    {
        "date":"2021-03-02",
        "week":"周二"
    },
    {
        "date":"2021-03-03",
        "week":"周三"
    },
    {
        "date":"2021-03-04",
        "week":"周四"
    },
    {
        "date":"2021-03-05",
        "week":"周五"
    },
    {
        "date":"2021-03-06",
        "week":"周六"
    },
    {
        "date":"2021-03-07",
        "week":"周日"
    },
    {
        "date":"2021-03-08",
        "week":"周一"
    },
    {
        "date":"2021-03-09",
        "week":"周二"
    },
    {
        "date":"2021-03-10",
        "week":"周三"
    },
    {
        "date":"2021-03-11",
        "week":"周四"
    },
    {
        "date":"2021-03-12",
        "week":"周五"
    },
    {
        "date":"2021-03-13",
        "week":"周六"
    },
    {
        "date":"2021-03-14",
        "week":"周日"
    },
    {
        "date":"2021-03-15",
        "week":"周一"
    }
]
  • timestampToTime 时间戳字符串格式化成日期字符串 参数(timestamp) timestamp 类型整数 如 1614474750082 13位时间戳 返回字符串 2021-02-28 9:12:30