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

@hangar55/dtm

v1.3.4

Published

An NPM package to handle date and time Converts between ms epoch time and human date; Adds/Remove seconds, minutes, hours or days to a given date; Checks if a given date is between an interval, before or after a given date

Downloads

17

Readme

@hangar55/dtm

An NPM package to handle date and time Converts between ms epoch time and human date Adds/Remove seconds, minutes, hours or days to a given date Checks if a given date is between an interval, before or after a given date

NPM Version Coverage Status

Install

npm i @hangar55/dtm

Methods

  • convert(string/number): changes between epoch/unix time and human readable date
  • string format: dd-mm-yyyy hh:mm:ss
  • changeDay(time, +/- days): adds or subtracts days to a given time. Time can be either human or epoch format.
  • changeHour(time, +/- hours): adds or subtracts hours to a given time. Time can be either human or epoch format.
  • changeMinute(time, +/- minutes): adds or subtracts minutes to a given time. Time can be either human or epoch format.
  • changeSecond(time, +/- seconds): adds or subtracts seconds to a given time. Time can be either human or epoch format.
  • isBetween(date, initial date, final date): Will return true if date is between the initial and final dates. Dates must be in human format.
  • isBefore(date, reference date): Will return true if date is before reference date. Dates must be in human format.
  • isAfter(date, reference date): Will return true if date is after reference date. Dates must be in human format.

Usage

const dtm = require("@hangar55/dtm");
console.log(dtm.convert(1234567890000));
prints 13-02-2009 23:31:30
console.log(dtm.convert("13-02-2009 23:31:30");
prints 1234567890000

console.log(`Now TimeZone -03:30: ${dtm.nowTimeZone("-03:30")}`);
const nowBrazil = dtm.nowTimeZone("-03:00");
console.log(`Now Brazil: ${nowBrazil}`);
console.log(`Change 2 days: ${dtm.changeDay(nowBrazil,2)}`);
console.log(`Change 2 hours: ${dtm.changeHour(nowBrazil,2)}`);
console.log(`Change 2 minutes: ${dtm.changeMinute(nowBrazil,2)}`);
console.log(`Change 2 seconds: ${dtm.changeSeconds(nowBrazil,2)}`);
console.log(dtm.isBetween("28-02-2000 23:59:59","01-01-1999 00:00:01", "29-02-2000 00:00:01"));
console.log(dtm.isAfter("28-02-2000 23:59:59", "01-01-1945 00:00:01"));
console.log(dtm.isBefore("28-02-1934 23:59:59", "01-01-1945 00:00:01"));

License

MIT