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 🙏

© 2026 – Pkg Stats / Ryan Hefner

grafana-date-picker

v1.1.0

Published

A powerful React date range picker inspired by Grafana

Readme

GrafanaDatePicker

一个功能强大的 React 日期范围选择器组件,灵感来源于 Grafana 的日期选择器。

特性

  • 🚀 快速选择预设时间范围:支持最近 5 分钟到最近 90 天的快速选择
  • 📅 日历视图:直观的日期选择界面,支持悬停预览选择范围
  • 精确时间控制:支持日期和时间的精确选择
  • 📝 表达式输入:支持类似 now-1h to now 的表达式输入
  • 🌍 时区支持:内置常用时区选择
  • 🎨 Grafana 风格:专业的界面设计和交互体验
  • 📱 响应式:适配不同屏幕尺寸
  • 🔧 TypeScript 支持:完整的类型定义

安装

npm install grafana-date-picker

使用示例

import { GrafanaDatePicker } from 'grafana-date-picker';
import dayjs from 'dayjs';
import { useState } from 'react';

// 导入样式
import 'grafana-date-picker/style.css';

function App() {
  const [dateRange, setDateRange] = useState<{ from: dayjs.Dayjs; to: dayjs.Dayjs } | null>(null);

  return (
    <div>
      <GrafanaDatePicker
        value={dateRange || undefined}
        onChange={setDateRange}
        placeholder="选择日期范围"
        timezone="Asia/Shanghai"
        showTimezone={true}
      />
    </div>
  );
}

API

Props

| 属性 | 类型 | 默认值 | 描述 | |------|------|--------|------| | value | { from: Dayjs; to: Dayjs } \| undefined | - | 当前选中的日期范围 | | onChange | (range: { from: Dayjs; to: Dayjs }) => void | - | 日期范围改变时的回调函数 | | placeholder | string | "选择日期范围" | 输入框占位符 | | timezone | string | dayjs.tz.guess() | 时区设置 | | showTimezone | boolean | true | 是否显示时区选择器 | | className | string | "" | 自定义 CSS 类名 |

快速选择选项

组件内置了丰富的快速选择选项:

常用时间范围:

  • 最近 5 分钟、15 分钟、30 分钟、1 小时、3 小时、6 小时、12 小时、24 小时

按天分类:

  • 今天、昨天、本周、上周、本月、上月、今年、上年

按周期分类:

  • 最近 3 天、7 天、30 天、90 天

表达式输入

支持以下表达式格式:

  • 相对时间:now-1h, now-1d, now-1w
  • 绝对时间:2024-01-01, 2024-01-01 15:30:00
  • 范围表达式:now-1h to now, 2024-01-01 to 2024-01-02

开发

# 安装依赖
npm install

# 启动开发服务器
npm run dev

# 构建生产版本
npm run build

# 预览构建结果
npm run preview

技术栈

  • React 18
  • TypeScript
  • Day.js
  • Tailwind CSS
  • Lucide React Icons

作者

作者:Claude
由 Anthropic 开发的大型语言模型

许可证

MIT License