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

date-compiler

v1.0.3

Published

快捷解析当前日期下的各种日期

Downloads

3

Readme

Getting Started

Documentation

解析moment和dayjs的字符串表达式,快捷生成日期

Installation

npm install date-compiler --save

API

适配moment.js

!!必须安装moment

import { execute } from "date-compiler/es/moment";
// 输出以指定时间为基础时间的前一天
execute("-1d", moment("2024-01-02")).format("YYYY-MM-DD") //2024-02-01

详细案例

适配dayjs

!!必须安装dayjs

import { execute } from "date-compiler/es/dayjs";
// 输出以指定时间为基础时间的前一天
execute("-1d", dayjs("2024-01-02")).format("YYYY-MM-DD") //2024-02-01

详细案例

自定义适配

参考

字符串规则

!!! 只包含+/-预算

s: 单位秒,+1s = 往后一秒,-5s = 往前5秒

m: 单位分,+1m = 往后一分,-5m = 往前5分

d: 单位小时,同上

d: 单位天,同上

w: 单位周,同上

M: 单位月,同上

Q: 单位季度,同上

y: 单位年,同上

--以下为获取当前的时间--------------------------- $s: 当前的秒,-$s = 当前秒数置为0

$m: 当前的分,-$s = 当前分数置为0

$h: 当前的小时,同上

$d: 当前的天(一周内),-$d = 周一

$D: 当前的天(一个月内),-$d = 当前月1号

$w: 当前的周数(一年内),-$w = 本年第一周

$M: 当前的月(一年内),-$M = 本年第一月

联系作者

[email protected]