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

best-calendar

v1.0.9

Published

this calendar lib encapsulation calendar's algorithm for get calendar data, have not DOM, you can customization style by yourself. 一个可以自己定制样式的日历库,没有dom操作, 只封装了日历的算法,得到需要的日历数据。

Downloads

17

Readme

best-canlender

this calendar lib encapsulation calendar's algorithm for get calendar data, have not DOM, you can customization style by yourself. 一个可以自己定制样式的日历库,没有dom操作, 只封装了日历的算法,得到需要的日历数据。

EN/ 中文文档

NPM version npm download

Introduction

this calendar lib encapsulation calendar's algorithm for get calendar data, have not DOM, you can customization style by yourself.

Installation

$ npm i best-calendar --save

usage

import

//By commonjs
const BTime = require('best-calendar')
//By ES6 module
import BTime form 'best-calendar'
//By DOM script
<script src="./js/BTime.min.js"></script>

use

let calendar = new BTime.Calendar({
    // ...some options
})

calendar.on('dateChange', function(date) {
    console.log(date)

    /**
        data = {
            currentYear:2017,
            currentMonth:12,
            currentDay:1,
            lastMonth:[26, 27, 28, 29, 30],
            nextMonth:[1, 2, 3, 4, 5, 6],
            thisMonth: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,15, 16, 17, 18, 19, 20, 21, 22, 23, 24,   25, 26, 27, 28, 29, 30, 31],
            today:"2018/3/7"
        }
    */
})

Configuration

let calendar = new BTime.Calendar({
    // ...some options
    firstColumnIsWeekend: true
})

firstColumnIsWeekend(# option)

default: true

if this calendar first column date is weekend set it true else set it false

API

goLastMonth(# method)

params: no params

go to the last month by current date then get last month calendar data and set current date to last month

goNextMonth(# method)

params: no params

go to the next month by current date then get next month calendar data and set current date to next month

goLastYear(# method)

params: no params

go to the last year by current date then get last year calendar data and set current date to last year

goNextYear(# method)

params: no params

go to the next year by current date then get next year calendar data and set current date to next year

go(# method)

params: one param
arguments[0] type: Number

examples: 
    calendar.go(-1)     // be equivalent to calendar.goLastMonth()
    calendar.go(-2)     // be equivalent to executed twice calendar.goLastMonth()
    calendar.go(-12)    // be equivalent to calendar.goLastYear()
    calendar.go(1)     // be equivalent to calendar.goNextMonth()
    calendar.go(12)    // be equivalent to calendar.goNextYear()

setCurrentDate(# method)

params: one param
arguments[0] type: [Object Date] or String

examples: 
    calendar.setCurrentDate(new Date('2018/3/8')) 
    calendar.setCurrentDate('2018/3/8')             // must be separated by '/'

on(# method)

params: two params
    arguments[0] type: String      "have only one event, that is 'dateChange'"
    arguments[1] type: Function    when date changed, execute the callback

execute functions 'setCurrentDate' 'go' 'goNextYear' 'goLastYear' 'goNextMonth' 'goLastMonth' will trigger this event

example:
    calendar.on('dateChange', function(date) {
        console.log(date)

        /**
            data = {
                currentYear:2017,
                currentMonth:12,
                currentDay:1,
                lastMonth:[26, 27, 28, 29, 30],
                nextMonth:[1, 2, 3, 4, 5, 6],
                thisMonth: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,15, 16, 17, 18, 19, 20, 21, 22, 23, 24,   25, 26, 27, 28, 29, 30, 31],
                today:"2018/3/7"
            }
        */
    })

if this lib is useful, star it on github,thanks