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

@sec-fe/sec-date-picker

v0.4.0

Published

> 一个时间选择器, 用于选择时间范围, 以及时间粒度.

Downloads

103

Readme

时间选择器

一个时间选择器, 用于选择时间范围, 以及时间粒度.

说明

基础语法规则: [+|-]<time_integer><time_unit>@<time_modifier><time_expression>

值(time_integer)

一个整数, 表示时间的数量, 例如: 1d, 表示 1 天后, 2w 表示 2 周后.

单位(time_unit)

时间单位, 共支持 6 种时间日期单位(s/m/h/d/w/mon/q/y):

  • s: 秒
  • m: 分钟
  • h: 小时
  • d: 天
  • w: 周
  • mon: 月
  • q: 季度
  • y: 年

例如: -1h, 表示 1 小时前, 2w, 表示 2 周后.

修饰符(time_modifier)

  • 常规修饰符: (now/@s/@m/@h/@d/@w/@mon/@q/@y/@w0~w7)

    • now: 当前时间; 例如: now > 2023-09-01 10:16:07
    • @s: 当前秒开始; 例如: @s > 2023-09-01 10:16:07
    • @m: 当前分钟开始; 例如: @m > 2023-09-01 10:16:00
    • @h: 当前小时开始; 例如: @h > 2023-09-01 10:00:00
    • @d: 当前天开始; 例如: @d > 2023-09-01 00:00:00
    • @w: 当前周开始(周一); 例如: @w > 2023-08-28 00:00:00
    • @mon: 当前月开始; 例如: @mon > 2023-09-01 00:00:00
    • @q: 当前季度开始; 例如: @q > 2023-07-01 00:00:00
    • @y: 当前年开始; 例如: @y > 2023-01-01 00:00:00
    • @w0~w7: @w0/@w7 表示周日, @w1 表示周一, 以此类推; 例如: @w1 > 2023-08-28 00:00:00
  • 扩展修饰符: (@ts/@m0~59/@h0~24/@mon1~12/@q1~4)

    • @ts: 13 位时间戳, 例如: 1693535243018@ts > 2023-09-01 10:27:23;
    • @m0~59: 每分钟开始, 例如: @m0 > 2023-09-01 10:00:00;
    • @h0~24: 每小时开始, @24 特殊表示 23:59:59, 例如: @h0 > 2023-09-01 00:00:00;
    • @mon1~12: 每月份开始, 例如: @mon1 >2023-01-01 00:00:00;
    • @q1~4: 每季度开始, 例如: @q1 > 2023-01-01 00:00:00;

表达式(time_expression)

计算表达式, 用于计算时间, 例如:

  • @d+1h > 2023-09-01 01:00:00
  • @d-1h > 2023-08-31 23:00:00
  • @d-1d-1s > 2023-08-30 23:59:59

示例

| 表达式 | 说明 | 结果 | |---------------|--------------------|---------------------| | now | 当前时间 | 2023-09-01 10:16:07 | | -1h | 1 小时前 | 2023-09-01 09:16:07 | | @d | 当天开始 | 2023-09-01 00:00:00 | | -1d@d | 昨天开始 | 2023-08-31 00:00:00 | | @w3 | 本周三 | 2023-08-30 00:00:00 | | -1w@w3 | 上周三 | 2023-08-23 00:00:00 | | -1w@d | 一周前 | 2023-08-25 00:00:00 | | -1mon@mon | 上个月开始 | 2023-08-01 00:00:00 | | -24h | 24 小时前 | 2023-08-31 10:16:07 | | -1d@h8 | 昨天 8 点 | 2023-08-31 08:00:00 | | -1d@h8+5m+30s | 昨天 8 点 5 分 30 秒 | 2023-08-31 08:05:30 |