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

@wdcjs/zilean

v0.0.15

Published

一个简易的时间库,基于 manba 封装

Downloads

12

Readme

@wdcjs/zilean

zilean (时间守护者 基兰) 是一个基于 manba 封装 使用 typescript 编写的简易的时间库。

快速上手

安装依赖

$ npm install @wdcjs/zilean
or
$ yarn add @wdcjs/zilean

在 React / Remax 中使用

Demo

import {Zilean} from '@wdcjs/zilean'

export default Demo = () => {
    // 获取当前年份
    console.log(Zilean.getYear())
    // 获取当前月份
    console.log(Zilean.getMonth())
    // 获取当前是周几
    console.log(Zilean.getDay())
    // 获取当前是几号
    console.log(Zilean.getDate())
    // 获取指定周天数
    console.log(Zilean.getMothDays(2022, 1))
    // 获取指定周天数
    console.log(Zilean.getWeeksDate(2022, 1, 1))
    // 获取指定月份 1号是星期几
    console.log(Zilean.getMothStartDay(2022, 1))
    // 日期对比
    console.log(Zilean.getMothEndDay(2022, 1))
    // 两个日期对比
    console.log(Zilean.compare('2022-01-01', '2022-01-02'))
    // 获取指定天数是星期几 2021/1/1 是周六, date 日期是从 0 开始并且为周日为起始天
    console.log(Zilean.getMothDay(2022, 1, 1))
    // 日期是否在开始和结束范围内 true
    console.log(Zilean.during('2022-01-01', '2022-01-03', '2022-01-02'))
    // 日期是否在开始和结束范围内 false
    console.log(Zilean.during('2022-01-01', '2022-01-03', '2022-01-04'))
    // 获取日期区间内的日期数组 , 支持传入 disableDate 默认为空数组 
    // 返回 ['2022-01-01','2022-01-02','2022-01-03','2022-01-04','2022-01-06']
    console.log(Zilean.during('2022-01-01', '2022-01-06', disableDate = ['2022-01-05']))
    // 获取月份区间内的月份数组 支持传入 disableMonth 默认为空数组
    // 返回 ['2022-01','2022-03','2022-04','2022-05','2022-06']
    console.log(Zilean.getDuringMonth('2022-01', '2022-06', ['2022-02']));
    // 获取当月的节日日期 
    /**
     * 返回数组
     *
     * [
     * { normal: '初七', festival: '元旦', year: 2020, month: 1, day: 1 },
     * { normal: '初八', year: 2020, month: 1, day: 2 },
     * { normal: '初九', year: 2020, month: 1, day: 3 },
     * { normal: '十日', year: 2020, month: 1, day: 4 },
     * { normal: '十一', year: 2020, month: 1, day: 5 },
     * { normal: '十二', year: 2020, month: 1, day: 6 },
     * { normal: '十三', year: 2020, month: 1, day: 7 }
     * ]
     */
    console.log(Zilean.getLunarDate(2020, 1, 1))
    /**
     *
     * 获取当前一周日期(从周一开始),如果不传参默认为当前日期
     * ['2022-3-14',
     '2022-3-15',
     '2022-3-16',
     '2022-3-17',
     '2022-3-18',
     '2022-3-19',
     '2022-3-20',
     * ]
     */

    console.log(Zilean.getNowWeek('2022-03-20'))
    /**
     * '获取当前一周时间(含天数和日期)
     * [
     {day: '周一', date: '2022-10-03'},
     {day: '周二', date: '2022-10-04'},
     {day: '周三', date: '2022-10-05'},
     {day: '周四', date: '2022-10-06'},
     {day: '周五', date: '2022-10-07'},
     {day: '周六', date: '2022-10-08'},
     {day: '周日', date: '2022-10-09'}
     ]
     */
    console.log(Zilean.getNowWeekDate('2022-10-08'))
}