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 🙏

© 2026 – Pkg Stats / Ryan Hefner

calendar-get

v2.0.0

Published

A class that retrieves only monthly or weekly data, suitable for items such as class schedules or monthly schedules.

Readme

calendar-get

一个仅获取月数据或周数据的类,适用于课程表或月计划表等项目。

A class that retrieves only monthly or weekly data, suitable for items such as class schedules or monthly schedules.

安装 install

npm i calendar-get --save

用法 use

基本使用

new CalendarGet(optinos) options 可不传默认是 {date: new Date, type: 'month', start: 1}

参数

options.date 默认值是 new Date()options.type 默认值是 'month',支持传 'month''week',传入其他值报错。 options.start 默认值是 1,支持传 10,传入其他值报错。

options.start

options.start 值是 1 时,按照(周一-周二-周三-周四-周五-周六-周日)的规则生成数据。 当 options.start 值是 0 时,按照(周日-周一-周二-周三-周四-周五-周六)的规则生成数据。 options.start 默认值是 1

CalendarGet 实例

// type 为 'month' 的实例
calendar.monthData // 当月所有天数数据
calendar.weekData // 当月所有天数数据
calendar.monthData42 // 6*7 适用于 42 天显示方式的月历数据
calendar.mYear // 年份
calendar.mMonth // 月份
calendar.mDate // 日期
calendar.mDay // 星期
...省略

示例 example

月 month

let calendar = new CalendarGet({ type: 'month', start: 1})
console.log(calendar.monthData)
// [
//   {
//     date: '2021-11-01',
//     mYear: 2021,
//     mMonth: 10,
//     mDate: 1
//     mDay: 1
//   },
//   ...
//   {
//     date: '2021-11-30',
//     mYear: 2021,
//     mMonth: 10,
//     mDate: 30
//     mDay: 2
//   }
// ]
console.log(calendar.monthData42)
// [
//   {
//     date: '2021-11-01',
//     mYear: 2021,
//     mMonth: 10,
//     mDate: 1
//     mDay: 1
//   },
//   ...
//   {
//     date: '2021-11-30',
//     mYear: 2021,
//     mMonth: 10,
//     mDate: 30
//     mDay: 2
//   }
//   ...
// ]

周 week

let calendar = new CalendarGet({ type: 'week', start: 1})
console.log(calendar.weekData)
// [
//   {
//     date: '2021-11-15',
//     mYear: 2021,
//     mMonth: 10,
//     mDate: 15
//     mDay: 1
//   },
//   ...
//   {
//     date: '2021-11-21',
//     mYear: 2021,
//     mMonth: 10,
//     mDate: 21
//     mDay: 0
//   }
// ]