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

cs-date

v1.0.1

Published

A date class of js, it inspired C# DateTime.

Downloads

6

Readme

CsDate

A date class of js, it inspired C# DateTime, format used fecha.

用法:

  • Create CsDate
  var date1 = new CsDate(); // now
  var date2 = new CsDate(new Date());
  var date2 = new CsDate(1473144953938); // Unix Timestamp
  var date3 = new CsDate("2016年09月06日 12时36分49秒", "YYYY年MM月DD日 HH时mm分ss秒");
  var date4 = new CsDate(2016, 1, 1, 12, 0, 0, 0);
  var date5 = CsDate.parseByCs('\/Date(1245398693390)\/'); // parse C#'s DateTime string
  var date6 = date5.copy();
  • CsDate 的方法
  //Default Date Format: YYYY-MM-DD HH:mm:ss
  
  date1.date(); // get date, example: 2017/09/14 15:00:00 -> 2017/09/14 00:00:00
  date1.year();
  date1.month();
  date1.day();
  date1.hour();
  date1.minute();
  date1.second();
  
  date1.utcYear();
  date1.utcMonth();
  date1.utcDay();
  date1.utcHour();
  date1.utcMinute();
  date1.utcSecond();
  
  date1.toString("YYYY年MM月DD日 HH时mm分ss秒");
  date1.toUtcString("YYYY年MM月DD日 HH时mm分ss秒");
  
  date1.addDays(1);
  date1.addHours(1);
  date1.addMinutes(1);
  date1.addMonths(1);
  date1.addSeconds(1);
  date1.addYears(1);
  
  date1.isEqual(date2);             // 是否等于
  date1.isGreater(date2);           // 是否大于
  date1.isLess(date2);              // 是否小于
  date1.isGreaterOrEqual(date2);    // 是否大于等于
  date1.isLessOrEqual(date2);       // 是否小于等于
  
  date1.getTimestamp();
  date1.getUnixTimestamp();
  
  var t = date1.subtract(date2); //date1 - date2, return CsTimeSpan
  • CsTimeSpan
  var t = CsTimeSpan.createNew(123);
  t.days();
  t.hours();
  t.minutes();
  t.seconds();
  t.milliseconds();