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 🙏

© 2024 – Pkg Stats / Ryan Hefner

fly-time

v1.0.5

Published

时间相关函数

Downloads

14

Readme

使用

import { getCurrentTime } from "fly-time"

一些常用的js函数,不局限于pc和移动端,持续更新中...

| 方法名 | 接受参数 | 示例 | | :------------------ | :----------------------------------------------- | :---------------------------------------------------------------------------------------------------------- | | getCurrentTime | string,yyyy-MM-dd/yyyy-MM-dd hh:mm:ss/yyyy-MM等 | getCurrentTime(' yyyy-MM-dd') | | getCountOfWeekX | startDate, endDate, weekX | 查找两个日期之间有几个星期几 2021-12-27到2022-01-27有几个星期五 getCountOfWeekX("2021-12-27","2022-01-27",weekX==7?0:weekX) | | getThirtyDay | number,30 | 当前日期后所有30天,getThirtyDay(30) | | assignAgoDate | number, | 当前前几天的日期,今天前7天是几月几日 assignAgoDate(7) | | assignAgoDay | date,ago | 传入指定日期的前几天所有,默认前7天;例assignAgoDay("2021-09-13",10) | | timestampTurnNormal | number | 时间戳转正常时间,例:timestampTurnNormal(1640750233) | | timeTurnTimestamp | time,milliscond=false 是否精确到毫秒 | 时间转时间戳,例:yyyy-MM-dd || yyyy-MM-dd hh:mm:ss | | backTimeText | string | 传入时间返回几分钟前,几小时前等 time=yyyy-mm-dd hh:mm:ss | | formatSeconds | number | 传入秒数转时分秒,常用于计时 | | getMonthDays | year,month | 获取某个月份的天数 getMonthDays(2021,12) | | getIsDiffOneYear | startDateStr,endDateStr | 获取2个日期相差是否超过1年, 超过1年: true, 未超过一年: false | | getWeek | string | 传入日期返回星期几,例:getWeek("2021-12-29") | | getDateRange | stime,etime | 获取两个日期中间的日期,格式2021-05-20,2021-05-24 | | getMonday | type,dates | type为字符串类型,有两种选择,"s"代表开始,"e"代表结束,dates为数字类型,不传或0代表本周,-1代表上周,1代表下周(getMonday("s",1) ) | | getDateFun | number | dates为数字类型,0代表今日,-1代表昨日,1代表明日,返回yyyy-mm-dd格式字符串,dates不传默认代表今日 | | getMonth | type,months | type为字符串类型,有两种选择,"s"代表开始,"e"代表结束,months为数字类型,不传或0代表本月,-1代表上月,1代表下月 getMonth("s",1) 得到下月第一天的yyyy-mm-dd格式日期 | | getCurrentMonth | showTime:false,//是否拼上时分秒 | 获取本月开始日期和结束日期 | | getCurrentSeason | showTime:false,//是否拼上时分秒 | 获取本季度开始日期和结束日期 | | getCurrentYear | showTime:false,//是否拼上时分秒 | 获取本年开始日期和结束日期 |