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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@featui/flat-datepicker

v0.1.1

Published

Flat datepicker build with moment and react

Readme

扁平化日期选择组件

一个扁平化的日期选择器。组件将用户设置日期时需要选择的元素(年、月、日、时、分)扁平化地展示出来,让用户快速选择日期,而不要来回切换“年月”等时间选择视图

Screenshot

使用示例:Storybook - FlatDatepicker

安装与使用

安装

npm install @feat/flat-datepicker

调用

import { FlatDatePicker } from '@feat/flat-datepicker'

function Example() {
  return (
    <FlatDatePicker
        pickerMode="normal"
        viewMode="Hm"
        format="H:m"
        onChange={console.log}
    />
  )
}

FlatDatePicker Prop Types

| Property | Type | Required? | Description | | :------------------------- | :------- | :-------: | :---- | | defaultValue | string,moment | | 默认值,在视图中会有灰色背景标示 | | modifier | string | | CSS BEM 方法中的 modifier,可以在自定义组件样式时使用 | | viewDate | string,moment,Date | | 视图日期 | | viewDateFormat | string | | 当 viewDate 为字符串类型时,需要提供 | | pickerMode | string | | 控制年月视图,显示历史日期 或者 将来的日期, 可选项: history, normal, future | | viewMode | string | | 控制组件的视图范围。 可选项: YMD, YM, Y, MD, Hm, YMDHm, 默认为 YMD | | minDate | string,moment | | 日期选择的最小值 | | maxDate | string,moment | | 日期选择的最大值 | | format | string | | 当 minDate 或者 maxDate 为字符串时,为必填项 | | originYear | number | | 年份根据 pickerMode 展开的起始点 | | yearRange | number | | 年份选择视图的范围,当 viewMode 中含有 Y 时,为必填项 | | labels | object | | 本地化标签,{ year, month, day, hour, miniute } | | onChange | function| √ |(moment, string) => void| isValid |function| |(m: moment, view: string, isMinView: boolean) => boolean, 控制选项是否可选 | | feedBack | function| |(m: moment, val: string) => void` |

其他示例

出生日期选择器

历史时间,且年满18岁

const BirthdayPicker = () => (
    <FlatDatePicker
        originYear={(new Date).getFullYear() - 18}
        pickerMode="history"
        modifier="ymd"
        viewMode="YMD"
        yearRange={72}
        onChange={console.log}
    />
)

信用卡有效时期

将来的时间,且5年之内

import moment from 'moment';

export const CreditCard = () => (
    <FlatDatePicker
        viewMode="YM"
        format="YYYY-MM"
        yearRange={5}
        pickerMode="future"
        minDate={moment()
            .startOf('month')}
        maxDate={moment()
            .add(5, 'year')
            .toISOString()}
        onChange={console.log}
    />
);

本地化

const HourMinute_CN = () => (
    <FlatDatePicker
      viewMode="Hm"
      format="HH:mm"
      onChange={action('onChange')}
      labels={{
        hour: '时',
        minute: '分',
      }}
    />
);

参与开发

master 分支中包含有这个组件的最新版本的代码。

可以通过一下步骤开始本地开发

  1. npm install
  2. npm run stroybook