Awesome Go

cronrange

CategoryDate and Time
SubcategoryDate and Time
Stars0

Parses Cron-style time range expressions, checks if the given time is within any ranges

About cronrange

cronrange

GoDoc License GitHub Action Workflow Go Report Card Codacy Badge Codecov

cronrange is a Go package for time range expression in Cron style.

In a nutshell, CronRange expression is a combination of Cron expression and time duration to represent periodic time ranges, i.e. Cron for TimeRange. And it made easier to tell if the moment falls within the any time ranges (use IsWithin() method), and what's the next occurrence (use NextOccurrences() method).

For example, every New Year's Day in Tokyo can be written as:

DR=1440; TZ=Asia/Tokyo; 0 0 1 1 *

It consists of three parts separated by a semicolon:

  • DR=1440 stands for duration in minutes, 60 * 24 = 1440 min;
  • TZ=Asia/Tokyo is optional and for time zone using name in IANA Time Zone database;
  • 0 0 1 1 * is a cron expression representing the beginning of the time range.

Installation

To download the package:

go get -u github.com/1set/cronrange

Usage

To import it in your program as:

import "github.com/1set/cronrange"

Examples can be found in GoDoc.

License

FOSSA Status

Frequently Asked Questions

What is cronrange?

cronrange is a Date and Time library for the Go programming language. Parses Cron-style time range expressions, checks if the given time is within any ranges

How do I install cronrange?

Install cronrange with the Go module system using `go get 1set/cronrange`. Check the repository for the current installation instructions.

What category does cronrange belong to?

cronrange is listed under Date and Time, specifically Date and Time.

← Back to Date and Time