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

s94-inputdate

v1.0.8

Published

时间选择控件

Downloads

3

Readme

s94-inputdate

时间日期选择工具

安装

$ npm install s94-inputdate

使用

var inputdate = require('s94-inputdate');
$('input[type="text"]').on('click',function(){
	//调起插件界面
	var _this = this;
	inputdate(function(res){
		_this.value = res; //把选择的时间结果,赋值到input里面
	},'Y-M-D H:I:S', this.value); //已input的值作为初始数据
})

属性和方法

inputdate(callback[, fmt, initdate]) 调起时间日期控件界面

inputdate.init(config) 初始化,或者修改配置

callback函数接受的数据格式

fmt说明

inputdate(callback[, fmt, initdate])

  • callback Function 接受时间日期选择的结果回调函数,接受一个对象,查看详细介绍
  • fmt String 返回的时间字符串格式样式,会根据fmt设定需要启用的控件,(默认值:Y-M-D H:I:S),查看详细介绍
  • initdate Date|String 初始化时间,为字符串格式需要和fmt一致,(默认值:new Date())
  • 返回 underfind

调起时间日期控件界面

var inputdate = require('s94-inputdate');
$('input[type="text"]').on('click',function(){
	//调起插件界面
	var _this = this;
	inputdate(function(res){
		_this.value = res; //把选择的时间结果,赋值到input里面
	},'Y-M-D H:I:S', this.value); //已input的值作为初始数据
})

inputdate.init(config)

  • config Object 配置参数
    • color String 高亮颜色
    • week Array 星期格式,星期天开头,默认['日','一','二','三','四','五','六']
    • month Array 月份格式,默认['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
    • img_left String 切换用的单箭头图片地址
    • img_left2 String 切换用的双箭头图片地址
  • 返回 underfind

控件初始化,inputdate()执行的时候会自动初始化,该函数一般用于修改配置,自定义控件风格

var inputdate = require('s94-inputdate');
inputdate.init({color: '#f00'});
$('input[type="text"]').on('click',function(){
	//调起插件界面
	var _this = this;
	inputdate(function(res){
		_this.value = res; //把选择的时间结果,赋值到input里面
	},'Y-M-D H:I:S', this.value); //已input的值作为初始数据
})

callback函数接受的数据格式

{
	value: "2022-01-25 20:25:33", //根据fmt格式化的时间字符串
	y: 2022, //年份的值{1970-}
	m: 1, //月份的值{1-12}
	d: 25, //当月第几天的值{1-31}
	h: 20, //小时的值{0-23}
	i: 25, //分钟的值{0-59}
	s: 33, //秒的值{0-59}
	Date: `Date`, //时间对象
}
//该对象可以直接当字符串使用,等效于value属性
inputdate(function(res){
	res.value == res; //true
	res.value === res; //false
}); //已input的值作为初始数据

fmt说明

返回的时间字符串格式样式。

字母ymdhis分别表示年月日时分秒,大写为有前置0、小写为没有前置0。

W为中文的星期几、w为星期序列(1为星期一... 7为星期天)

该参数和 s94.date(fmt[, time]) 中的fmt相同