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

tqb-component-date-picker

v1.2.1

Published

a date picker component for 天气宝

Downloads

3

Readme

日期选择控件 Date Picker

这是供天气宝使用的日期选择控件,用在移动设备上

A date picker component for 天气宝

GitHub

需求 Requirements

安装使用 Installation

本控件会自动初始化页面中含有 .tqb-date-picker-input 样式的标签,并将其设置为 readonly。使用时只需要引用响应的 CSS、JS 文件即可。

本控件会从目标 <input>data-* 属性取初始化数据,目前支持以下参数:

| 参数 | 功能 | |------|------| | confirm | 是否需要用户主动点击“确认”,false 或无此属性都会自动将选定的日期填入输入框 | | scattered | 可选日期是否是不连续的 | | multiple | 不连续日期选择时,是否可选多个日期 | | start | 可选日期范围的起点,默认是今天 | | end | 可选日期范围的终点,为空则没有,即用户可以选择任意时间 | | range | 起始日期之间的跨度,只在事件段选择时生效 | | format | 日期格式,默认为 yyyy-mm-dd,无大小写区分 | | labelFilterStart | 输出到开始日期 里的日期格式 | | labelFilterEnd | 输出到结束日期 里的日期格式 |

不连续日期

选择不连续日期时,每次点击选择一个日期。提交时,将修改 <input> 中的值,为所有选中的日期,用英文逗号(,)相连。

连续时间段

选择连续时间段时,本控件会生成两个新的 <input type="hidden"> ,分别名为 ${name}-start${name}-end,用来提交起止日期。另外:

  • 开始日期,会自动补上 00:00,比如选择 2017-02-28,表单中的值就是 2017-02-28 00:00
  • 结束日期,会自动补上 23:59,比如选择 2017-02-28,表单中的值就是 2017-02-28 23:59
  • 显示的文本框里的值是 ${start} ~ ${end},这个只用来向用户展示,并不直接提交。

代码范例

<!doctype html>
<html>
<head>
  <meta name="viewport" content="initial-scale=1,user-scalable=no">
  <link rel="stylesheet" href="path/to/tqb-date-picker.min.css">
  <link rel="stylesheet" href="your/own/css/css.css">
</head>
<body>

<input type="text" class="tqb-date-picker-input"
    data-scattered="true" <!-- 选择不连续日期 -->
    data-start="2017-06-26" <!-- 可选日期从 2017-06-26 开始 -->
    data-format="yyyy-mm-dd" <!-- 日期输出的格式为 yyyy-mm-dd,如 2017-06-26 -->
    >
<script src="path/to/jquery.js"></script>
<script src="path/to/tqb-date-picker.min.js"></script>
<script src="path/to/your/own/js/js.js"></script>
</body>

Todo

  • UI Tests