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

time-counting

v2.0.2

Published

You can see how long ago or how long since today.

Downloads

40

Readme

time-counting

Travis ci Github issues Githug stars Github license Downloads Npm version 📦 오늘로부터 해당 날짜가 며칠 전인지, 며칠 후인지 알 수 있도록 해주는 패키지입니다.

English

설치

npm 혹은 yarn 으로 설치 할 수 있습니다.

npm

$ npm install time-counting --save
$ yarn add time-counting

사용 방법

Javascript

// es5
const TimeCounting = require("time-counting");
const time = TimeCounting("2020-08-10");
const timecount = TimeCounting("2020-08-10 08:00:00", {
  objectTime: "2020-08-10 10:00:00"
});

//es6
import TimeCounting from "time-counting";
console.log(TimeCounting("2020-08-10"));
console.log(
  TimeCounting("2020-08-10 08:00:00", {
    objectTime: "2020-08-10 10:00:00",
    lang: "ko"
  })
);
오늘을 기준으로 2020년 8월 10일이 며칠 전/후 인지 결과로 나타납니다.
두 번째 결과는 2020년 8월 10일 10시를 기준으로 2020년 8월 10일 8시의 시간을 확인합니다.

2시간 전

TypeScript

import TimeCounting from "time-counting";
console.log(TimeCounting("2020-08-10", { objectTime: "2020-08-11", lang: "ko" }));
1일 전

옵션

| Name | Value | default | description | | :--------: | :------------------: | :--------: | :------------------------------------------: | | objectTime | Date, string, number | new Date() | 기준이 되는 시간입니다. | | lang | "ko", "en" | "en" | 언어 | | calculate | Calculate | Calculate | 해당 값까지 초/분/시간/일 ... 을 출력합니다. |

Calculate

| Name | Value | default | Unit | | :-----: | :----: | :-----: | :----: | | justNow | number | 20 | second | | second | number | 60 | second | | minute | number | 60 | minute | | hour | number | 24 | hour | | day | number | 7 | day | | week | number | 4 | week | | month | number | 12 | month |

예시

const option = {
  objectTime: "2020-08-10 06:00:00",
  lang: "ko",
  calculate: {
    justNow: 3601
  }
};
console.log(TimeCounting("2020-08-10 05:00:00", option));
방금 전

💬 1시간 1초까지는 "방금 전" 으로 표시됩니다.

Testing

npm run test