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

cron-time-converter

v1.0.0

Published

Convert natural language scheduling phrases into standard 5-field cron expressions

Readme

cron-time-converter

Convert natural language scheduling phrases into standard 5-field cron expressions.

Installation

npm install cron-time-converter

Usage

import { parse } from "cron-time-converter";

parse("every minute");           // "* * * * *"
parse("every 5 minutes");        // "*/5 * * * *"
parse("every hour");             // "0 * * * *"
parse("every 6 hours");          // "0 */6 * * *"
parse("every day");              // "0 0 * * *"
parse("every day at 3pm");       // "0 15 * * *"
parse("every day at 11:30pm");   // "30 23 * * *"
parse("every day at 12pm");      // "0 12 * * *"  (noon)
parse("every day at 12am");      // "0 0 * * *"   (midnight)
parse("every weekday");          // "0 0 * * 1-5"
parse("every weekend");          // "0 0 * * 0,6"
parse("every sunday");           // "0 0 * * 0"
parse("every friday at 5:30pm"); // "30 17 * * 5"
parse("every month");            // "0 0 1 * *"
parse("every month on day 15");  // "0 0 15 * *"

// Unsupported / ambiguous input
parse("every fortnight");        // "ERROR"
parse("do something");           // "ERROR"

API

parse(input: string): string

Converts a natural language phrase to a 5-field cron expression.

| Parameter | Type | Description | |-----------|----------|--------------------------------| | input | string | Natural language schedule phrase |

Returns the cron expression string, or "ERROR" if the input is unsupported or ambiguous.

Supported patterns

| Input pattern | Output | |---------------------------------|---------------------| | every minute | * * * * * | | every X minutes | */X * * * * | | every hour | 0 * * * * | | every X hours | 0 */X * * * | | every day | 0 0 * * * | | every day at H(:MM)am/pm | MM HH * * * | | every weekday | 0 0 * * 1-5 | | every weekend | 0 0 * * 0,6 | | every <dayname> | 0 0 * * N | | every <dayname> at H(:MM)am/pm| MM HH * * N | | every month | 0 0 1 * * | | every month on day N | 0 0 N * * |

Time parsing rules

  • Times use 12-hour am/pm format: 3pm, 3:30pm, 11:45am
  • 12pmnoon (12:00)
  • 12ammidnight (00:00)
  • 0ammidnight (00:00)
  • When no time is specified for a day-based schedule, midnight (00:00) is used

Day names

Full names (sunday, monday, …saturday) and 3-letter abbreviations (sun, mon, …sat) are both accepted. All input is case-insensitive.