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

ng-datetimerange-picker

v1.2.4

Published

一个全新的简洁美观的日期时间范围选择器

Downloads

2

Readme

ng-datetimerange-picker

一个全新的简洁美观的日期时间范围选择器(样式参考iviewui)


Installation

bower:
bower install
npm:
npm install


Usage

a. 引入文件

  <link rel="stylesheet" href="../node_modules/ng-datetimerange-picker/dist/styles/ngDatetimeRangePicker.css">
  <script src="../node_modules/ng-datetimerange-picker/dist/scripts/ngDatetimeRangePicker.js"></script>

b. 在模块中进行依赖

  angular.module('yourModule', ['ngDatetimeRangePicker'])

c. 使用指令ng-date-picker

  <ng-date-picker 
          id="test-picker"
          style="width: 280px;" 
          value="rctrl.dateConf.value" 
          format="{{rctrl.dateConf.format}}" 
          placeholder="{{rctrl.dateConf.placeholder}}" 
          options="rctrl.dateConf.options"
          on-ok="rctrl.okFunc(value)"
          on-clear="rctrl.clearFunc()"
          on-change="rctrl.changeFunc(value)"
          is-global="rctrl.dateConf.isGlobal"
          pos="cover"></ng-date-picker>

Configurations

目前总共提供四个配置选项

  • [必选 Object] value:日期时间范围,格式为:{ start: moment(), end: moment()}
  • [可选 String] format:格式,配置参考moment.js
  • [可选 String] placeholder: 占位符
  • [可选 Object] options:可选配置项
  • [可选 Function] on-ok:点击确定回调的钩子函数
  • [可选 Function] on-clear:点击清空回调的钩子函数
  • [可选 Function] on-change:当值发生变化时回调的钩子函数
  • [可选 Boolean] is-global: 是否应用到全局环境,默认为false,即相对input的位置出现。true情况下将添加到全局body中,此时不会被任何东西遮盖(比如父级的overhidden)
  • [可选 Attribute] pos: 组件面板出现的位置。在is-global配置为true的情况下生效。选项分别为center right cover cover-center cover-left cover-right

参考以下配置:

this.okFunc = function(value){
    console.log('okkkkkkkkkk', value);
}
this.clearFunc = function(){
    console.log('clearrrrrrr');
}
this.changeFunc = function(value){
    console.log('changeeeeee', value);
}
this.dateConf = {
    isGlobal: true,
    value: {
        start: moment(),
        end: moment().month(11).add(1, 'y').add(2, 'd').add(13, 'h').add(2, 'm').add(3, 's')
    },
    format: 'YYYY-MM-DD HH:mm:ss',
    placeholder: '请选择日期范围',
    options: [{
            name: '今天',
            start: moment().startOf('day'),
            end: moment().endOf('day')
        },
        {
            name: '昨天',
            start: moment(),
            end: moment().subtract(1, 'd')
        },
        {
            name: '当前月',
            start: moment().startOf('month'),
            end: moment()
        },
        {
            name: '一年又两个月',
            start: moment().subtract(1, 'M'),
            end: moment().add(1, 'y').add(1, 'M')
        }
    ]
};