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

@danny_lei/current-date-weekday

v1.0.4

Published

Real-time computer year/month/day and weekday helper (TypeScript, zero dependencies)

Readme

@danny_lei/current-date-weekday

实时计算计算机当前的「年月日」和「星期几」——一个极简、零依赖的 TypeScript 工具库。

读取宿主进程的本地时钟(new Date() + Intl),返回纯 JSON 结果,可直接 npm install 后在你的项目里调用。

安装

npm install @danny_lei/current-date-weekday

用法

ESM

import { getCurrentDateWeekday } from '@danny_lei/current-date-weekday'

const today = getCurrentDateWeekday()
console.log(today.friendly) // 今天是 2026年9月26日,星期六
console.log(today.date)     // 2026-09-26
console.log(today.weekdayZh) // 星期六

CommonJS

const { getCurrentDateWeekday } = require('@danny_lei/current-date-weekday')

console.log(getCurrentDateWeekday())

计算指定时间点(默认是「此刻」)

import { getToday } from '@danny_lei/current-date-weekday'

// 传入固定 Date 可计算该瞬间的年月日与星期(也便于测试)
console.log(getToday(new Date('2026-09-26T10:00:00+08:00')))

返回结果

interface CurrentDateWeekday {
  year: number        // 2026
  month: number       // 9
  day: number         // 26
  weekday: number     // 6(0=周日 … 6=周六,与 Date#getDay() 一致)
  weekdayEn: string   // "Saturday"
  weekdayZh: string   // "星期六"
  date: string        // "2026-09-26"
  friendly: string    // "今天是 2026年9月26日,星期六"
  iso: string         // "2026-09-26T02:00:00.000Z"
  timezone: string    // "Asia/Shanghai"
}

API

| 导出 | 说明 | | --- | --- | | getCurrentDateWeekday(now?) | 主函数,返回当前(或指定瞬间)的年月日与星期信息 | | getToday(now?) | 与上面等价的简短别名 | | CurrentDateWeekday | 返回结果的 TypeScript 类型 |

开发

npm install
npm run build   # tsc 编译到 dist/,并生成 .d.ts

License

MIT