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

runicjs

v1.0.0

Published

Stupid string to duration converter

Downloads

2

Readme

runic

Stupid string to duration converter

General usage

Two mods are available: using timeout and/or using exact time. It's not either-or, feel free to mix everything, even multiple times during the same command.

Order of timeouts, exact times and custom text is not important at all, you are free to specify the timer however you want to!

Quick example for the timeout:

"pause in 3 min"

Quick example for the exact time:

"I should leave at 6pm"

In the latter, it will calculate duration between your local "now" and specified exact time.

To Message, Or not to Message

The following timers are exactly the same, all three of them will return the same duration back.

"4 minutes"
"4m" # You have different methods to write the length (See below for more)
"remind me that I have a tea in the kitchen in 4 min"

Learn by Example

The simplest timer you can launch

"my first timer ever for 30 seconds"

This will simply return 30 seconds!

You can combine multiple durations

These durations might be of any length as long as it makes sense to you!

"1 minute 30s .5m 3600 seconds"

This will return an hour and 2 minutes!

Exact times can be used

Duration between current time and specified value will be calculated and added:

consider it is 8 am now (08:00)

"remind me to join the meeting call at 9:15"

This will return an hour and 15 minutes!

You can use - in front of the duration

It will tell the timer that you want to move the target one hour towards your current time:

"2h -1h -30m"

This will return 30 minutes!

It works great when using with exact times

consider it is 4pm now (16:00)

"originally event starts at 6pm was moved 1 hour I need -2 hours to get there"

This will return an hour!

Timeout

Timer is a total of all specified timeouts combined. You can specify timeouts using keywords for hours, minutes and seconds.

Note that the space between the timeout and keyword is optional.

Hours

  • hours
  • hour
  • hrs
  • hr
  • h

E.g.

"10h"
"10 hr"
"10 hours"

Minutes

  • minutes
  • minute
  • mins
  • min
  • m

E.g.

"10m"
"10 min"
"10 minutes"

Seconds

  • seconds
  • second
  • secs
  • sec
  • s

E.g.

"10s"
"10 sec"
"10 seconds"

Floating numbers

You can use . in your timeouts. For example, when you need to quickly specify 2 hours 30 minutes, but you don't want to write it down, you can do this:

"the long and boring way 2 hours 30 minutes"
"slightly shorter but still boring way 2h 30m"
"or in short 2.5h"

Or, possibly the shortest way to describe 30 minutes is:

".5h and it will be done"

Exact Time

Used to specify some time of interest explicitly. Under the hood it calculates the duration between the local now and local time and launches an ordinary timeout:

"should finish at 19:30"
"should finish at 7:30pm"

Just like with timeouts, the space between the time and "am"/"pm" is optional.

"at 1am"
"at 1 am"

Minutes part is optional and is going to be set to 0 by default, so the following timers are equal:

"at 22"
"at 22:00"
"at 10pm"
"at 10:00 pm"

Where a day starts and ends?

In case specified time is in the past relative to the current 24h day, it carries out to the next day, for example:

Consider it is October 1st, 11:30pm (23:30)

"definitely go to sleep at 2am"

There already was point in time when 2am of October 1st occurred, so it carries out to the next day, October the 2nd, effectively setting your timer for 2 hours 30 minutes.

The same happens with more distant points in time, like this:

consider it is October 1st, 4:15pm (16:15)

"at 4:15am"