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

@nimaimalle/go-time

v1.3.4

Published

Define recurring blocks of time and test for containment

Readme

Go-Time

GoTime is a simple but powerful library and syntax for defining times when you desire something to be active, and test dates against that definition.

.'`~~~~~~~~~~~`'.
(  .'11 12 1'.  )
|  :10 \|   2:  |
|  :9   @   3:  |
|  :8       4;  |
'. '..7 6 5..' .'
 ~-------------~

GoTime Syntax

A GoTime definition is a series of test statements, each following this pattern: {part}{operator}{value}

Part

The first section of a test is the part, and it can be one of the following:

| Part code | Meaning | | ---------- | ---------------------------------------------------------- | | y | Year. i.e. 2021 | | m | Month. 1 - 12 or Jan or January, etc. | | woy | Week of the Year. 1 - 53 | | wom | Week of the Month. 1 - 5 | | doy | Day of the Year. 1 - 365 | | dom | Day of the Month. 1 - 31 | | dow | Day of the Week. 1 - 7 or Monday or Mon, etc. Monday is 1. | | time | Time of Day. 00:00 - 23:59 must have hours : minutes | | datetime | A complete date time value like yyyy-mm-dd hh:mm:ss |

Operator

The second section of a GoTime test is the operator. | Operator | Meaning | | --- | --- | | = | Equals | | <= | Less than or equal | | >= | Greater than or equal | | < | Greater than | | > | Less than |

Value

The third section of a GoTime test is the value. Valid values depend on the part used in the test. For example, m=2022 is invalid because the m (Month) part is being used, and 2022 isn't a valid Month.

This section can declare a single value, a series of comma separated values, or a span of values with a minimum (inclusive) and maximum (exclusive) separated by a dash or pipe. Only the equals operator can be used with the comma separated values or span syntax; it doesn't make sense to be less than a span or a list of values, for example.

Multiple Statements

A GoTime definition needs at least one test statement, but can include multiple tests separated by a semicolon. Tests using the same part are OR'd together, so if any one is true, the part test passes. For the entire definition to evaluate to true, a the input Date must pass every part. See the exmaples below.

GoTime Examples

Here are some example definitions | Definition Syntax | Meaning | | --- | --- | | M=Oct; DoM>=24 | Halloween week. The last 7 days of October. | | DoM<7; DoW=Sat,Sun | The first weekend of the month. (Might only be one Sunday!) | | Time=00:00-01:00; Time=12:00-13:00 | Midnight hour or noon hour | | Datetime>2022-04-20 | After a specific point in time | | Datetime=2022-03-20 13:00:00\|2022-03-22 05:30:00 | Between two absolute points in time (separate by pipe symbol; only escaped for markdown) |

GoTime Usage

const firstWeekend = new GoTime('DoM<7; DoW=Sat,Sun')
const now = new Date()
if (firstWeekend.test(now)) {
  // Do something here
}