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

@kyfe/attendance-time-range-popup

v1.0.2

Published

移动端日期时间范围选择组件

Readme

传参

title

type: String default: '请选择时间'

popup 标题

value

type: Boolean default: false

popup 显示状态,支持 v-model 双向绑定

saveText

type: String default: '确定'

"确定"按钮文本内容

dataInfo

type: Object default: {}

配置对象,各字段说明如下:

| 字段名 | 类型 | 默认值 | 说明 | |--------|------|--------|------| | activeType | Number | 1 | 当前聚焦的时间类型:1 开始时间,2 结束时间 | | minDate | String | null | 最小可选择的日期,格式 YYYY-MM-DD,早于该日期的选项会被禁用 | | maxDate | String | null | 最大可选择的日期,格式 YYYY-MM-DD,晚于该日期的选项会被禁用 | | monthsInAdvance | Array | [-2, -1, 0, 1] | 可选月份偏移量数组,控制日期选择器展示哪些月份(相对当前月) | | startTime | String \| Number | null | 开始时间的初始值 | | endTime | String \| Number | null | 结束时间的初始值 | | defaultEndTime | String \| Number | null | 切换到结束时间时的默认填充值 |

事件

input

参数: Boolean

popup 关闭时触发,用于 v-model 同步显示状态

capture

参数: String

点击"确定"按钮后校验失败时触发,参数为错误提示文本。常见校验场景:

  • 未选择开始时间:请选择开始时间
  • 未选择结束时间:请选择结束时间
  • 开始时间晚于结束时间:结束时间不能早于开始时间

confirm

参数: { startTime: Number, endTime: Number }

点击"确定"按钮且校验通过时触发,返回的开始时间和结束时间均为 13 位时间戳(毫秒)

使用示例

<template>
  <DatePickerPopup
    v-model="showPopup"
    title="请选择时间"
    :dataInfo="dataInfo"
    @capture="handleCapture"
    @confirm="handleConfirm"
  />
</template>

<script>
export default {
  data() {
    return {
      showPopup: false,
      dataInfo: {
        activeType: 1,
        minDate: '2024-01-01',
        maxDate: '2024-12-31',
        monthsInAdvance: [-1, 0, 1],
        startTime: null,
        endTime: null,
        defaultEndTime: null
      }
    }
  },
  methods: {
    handleCapture(tipText) {
      console.log('校验失败:', tipText)
    },
    handleConfirm({ startTime, endTime }) {
      console.log('开始时间:', startTime)
      console.log('结束时间:', endTime)
    }
  }
}
</script>