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

qyjutils

v1.0.6

Published

Some utility functions for cloud function develeopment of Tencent miniprogram. 给小程序云函数公用的一些工具方法

Downloads

10

Readme

qyjUtils

Some utility functions for cloud function develeopment of Tencent miniprogram. 给小程序云函数公用的一些工具方法

qyjUtils.getDateByIndex(indexes) ⇒ Object

根据小程序生日picker组件生成的index,返回实际的日期

Kind: static method of qyjUtils
Returns: Object - {isLunar, date}

| Param | Type | Description | | --- | --- | --- | | indexes | Array | 生日picker组件保存的index值数组。比如:[1,2,3] 农历 3-4 |

qyjUtils.getBirthdayDiff(birthdayStr, threshold, isLunar) ⇒ Number

获取离生日 date 相差几天,支持农历。返回值为整数。

Kind: static method of qyjUtils
Returns: Number - 生日未过且离${threshold}天以内返回原值,否则返回-1

| Param | Type | Description | | --- | --- | --- | | birthdayStr | String | 日期字符串,比如:'5-3' | | threshold | Number | 最大差值的阈值,比如传入 7,那么相差7天以上的话就返回-1 | | isLunar | Boolean | 日期是公历还是农历,默认公历 |

qyjUtils.getDateDiff(date1, date2) ⇒ Number

获取两个date差几天。

Kind: static method of qyjUtils
Returns: Number - 默认排序规则,date1小,date2大,返回正数。反之返回负数。

| Param | Type | | --- | --- | | date1 | Object | | date2 | Object |

qyjUtils.getLunarDate(date) ⇒ String

获取某一天的农历日期。返回值为日期字符串

Kind: static method of qyjUtils
Returns: String - 农历日期字符串

| Param | Type | Description | | --- | --- | --- | | date | String | 公历日期字符串,比如:'2022-5-3' |

qyjUtils.todayFMD() ⇒ Object

获取当日的结构化对象

Kind: static method of qyjUtils
Returns: Object - {year, month, day}

qyjUtils.toDateStr(date) ⇒ String

获取日期字符串

Kind: static method of qyjUtils
Returns: String - 日期字符串,比如:'2022-5-20'

| Param | Type | Description | | --- | --- | --- | | date | Object | 结构化日期对象 |

qyjUtils.toFMD(dateStr) ⇒ Object

返回日期字符串对应的结构化对象

Kind: static method of qyjUtils
Returns: Object - {year, month, day}

| Param | Type | Description | | --- | --- | --- | | dateStr | String | 日期字符串 |

qyjUtils.addNDay(date, n) ⇒ Object

获取某日的后n天日期对象:按时间戳计算偏移,再反解析为日期

Kind: static method of qyjUtils
Returns: Object - 日期对象

| Param | Type | Description | | --- | --- | --- | | date | Object | 日期对象 | | n | Number | 数字 |

qyjUtils.substractNDay(date, n) ⇒ Object

获取某日的前n天日期对象:按时间戳计算偏移,再反解析为日期

Kind: static method of qyjUtils
Returns: Object - 日期对象

| Param | Type | Description | | --- | --- | --- | | date | Object | 日期对象 | | n | Number | 数字 |

qyjUtils.getLunarDay(date) ⇒ String

获取农历是哪天(初几)

Kind: static method of qyjUtils
Returns: String - 农历日子。比如:'初三'

| Param | Type | Description | | --- | --- | --- | | date | Object | 日期对象 |