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

ph-calendar

v0.2.0

Published

calendar component for phoenix-ui

Downloads

3

Readme

ph-calendar

calendar component for phoenix-ui

Install

$ npm install ph-calendar --save 

Usage

import React, {Component, PropTypes} from 'react'
import PhCalendar from 'ph-calendar'

class Demo extends Component {
    constructor(props, context) {
        super(props, context)
            this.state = {
                values: [new Date(2017, 1, 24), new Date(2017, 2, 10)],
                disabled:[new Date(2017, 2, 14), new Date(2017, 2, 17)],// start end 包括
                weekStart: 1,
                monthCount: 5,
                range: true,
                monthStart: 'top', //['top', 'center', 'bottom']
                //weekLabel: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
                events: [
                    {
                        date: new Date(2017, 1, 10),
                        name: '家立减'
                    },
                    {
                        date: new Date(2017, 1, 22),
                        name: '团购'
                    },
                    {
                        date: new Date(2017, 2, 10),
                        name: '劳动节'
                    },
                    {
                        date: new Date(2017, 2, 15),
                        name: '哈哈哈'
                    }
                ]
            }
    }
    chooseCallback(data){
        console.log('选择后的日期', data)
    }
    render() {
        const {values, disabled, weekStart, events, weekLabel, range, monthCount} = this.state
        return (
            <div className="rcs-demo">
                <PhCalendar 
                    values={values}
                    dateChose={this.chooseCallback}
                    disabled={disabled}
                    events={events}
                    monthCount={monthCount}
                    weekStart={weekStart}
                    weekLabel={weekLabel}
                    range={range}
                    monthStart={monthStart}/>
            </div>
        )
    }
}

Options

支持的属性配置:

  • values : 日期对象数组,设置日历的选中日期,默认为空数组。 eg: 时间范围:[new Date(2017, 1, 24), new Date(2017, 2, 10)]
  • disabled :日期对象数组,设置禁用的日期,默认为空数组。 如果设置的值恰好为 2 个,则表示禁用的是一段日期。传如一个或者三个以上,则表示为单个日期禁用
  • dateChose :日期选择回调函数,默认为空函数。单个日期模式下,选中一个日期则处罚;日期范围模式下,选中两个日期才触发
  • range:布尔值,设置日历选择日期的模式,默认为 truetrue 表示范围选择,false 表示单选
  • monthCount:正整数,设置单页日历的个数,默认为 6。最小值为 3,最大值为 12
  • weekStart:非负整数,设置一周的开始时间,默认为 1。取值范围是 new Date().getDay() 值的集合,即为 0、 1、 2、 3、 4、 5、 6,分别表示周日、周一、周二、周三、周四、周五、周六
  • weekLabel:字符串数组,设置周的显示格式,默认为 ['日', '一', '二', '三', '四', '五', '六']
  • format:字符串,设置日期的显示格式,默认为 yyyy-MM-dd
  • events:对象数组,设置日历事件显示,默认为空数组。对象的格式为 {'date': [Date Object], 'name': [String Object]},eg: [{'date': new Date(2016, 4, 1), 'name': '劳动节'}]
  • monthStart:字符串,设置日历的默认显示方式,默认为 top。可选值为['top', 'center', 'bottom'], top 表示日历按照选中日期递增方式显示,top 表示日历按照选中日期两端延伸方式显示,bottom 表示日历按照选中日期递减方式显示,

Example

效果图如下:

在线效果请看 ph-calendar
详细请参见examples 目录下 demo,更改对应参数查看效果,具体步骤参见下面 Command

Command

# clone 代码仓库
$ git clone https://github.com/future-team/ph-calendar.git && cd ph-calendar
# 安装依赖
$ npm install 
# 查看demo
$ npm run demo 

Repair

  • 0.1.0 第一版本发布