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

zy-date-to-calendar

v1.0.6

Published

传入日期参数,生成日历展示,样式可配置

Downloads

11

Readme

参数详情

| 参数值 | 是否必填 | 参数类型 | 举例 | | ---------|---- | -----| ------- | | el | 必填 | Dom节点 | document.getElementById('#content')、this.$refs['content'] | | options.date | 必填 | String、Array | '2021-6'、 ['2021-5-1', '2021-6-12'] | | options.backgroundDict | 非必填 | Object | {'1' : 'red', '2': 'yellow', .... , '11': 'blue', '12': 'green'} | | options.thColor | 非必填 | String | '#000' | | options.thBackground | 非必填 | String | '#000' | | options.emptyThBackground | 非必填 | String | '#000' | | options.tdWidth | 非必填 | Number、String | 120 、 '120' | | options.tdHeight | 非必填 | Number、String | 40 、 '40' | | options.isShowAstro | 非必填 | Boolean | true | | options.isShowChinese | 非必填 | Boolean | true |

用法如下

执行命令:npm i zy-date-to-calendar
引入方法:import { toCalendar } from "zy-date-to-calendar"
html部分
<!DOCTYPE html>
<html>
    <head>
        <mate charest="utf-8" />
        <title>demo</title>
    </head>
    <body>
		<div id="content"></div>
    </body>
</html>
javascript部分
    toCalendar(document.getElementById('#content'),{
        date:'2021-6',//日期范围:两个日期数组,一个日期字符串
        backgroundDict:null,//12个月份的td背景颜色
        thColor:'',//表头的文字颜色
        thBackground:'',//表头的背景颜色
        emptyThBackground:'',//空td的背景色
        tdWidth:130,//th,td的宽度
        tdHeight:0,//th,td的高度
        isShowAstro:false,//是否显示星座
        isShowChinese:true,//是否显示农历信息
    })
注:toCalendar方法两个参数,第一个是需要渲染的父节点,须为dom元素且不为null;第二个参数options是配置项,其中date可以是日期字符串或者两个日期字符串组成的数组、backgroundDict是1-12月之间的td背景颜色,对象键为相应的月份、值为颜色值。