← All procedures

schedule.next

The next times of a cron expression

CLI
Package
@procedures/schedule · README
Path
["schedule","next"]
CLI
mark schedule next --cron <string>
As data
{"$proc":["schedule","next"],"input":{}}
Tags
schedule, cron

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/schedule/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["schedule","next"], { cron: "<cron>" });
console.log(JSON.stringify(result));

From the command line

$ mark schedule next --cron <string>

As data, in a program

{ "$proc": ["schedule", "next"], "input": { "cron": "<cron>" } }

Input

FieldTypeRequiredDefaultDescription
cronstringyesThe cron expression: 5 fields (minute hour day month weekday), or @hourly, @daily, @weekly, @monthly, @yearly
countintegernoThe number of times, 1 to 100 (default 5)
afterstringnoThe times come after this ISO time (default now)
timeZonestringnoThe time zone of the expression: utc, local (default) or an IANA name such as Europe/Berlin

Output

FieldTypeRequiredDefaultDescription
timesstring[]yesThe next times as ISO texts
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "cron": {
        "type": "string",
        "minLength": 1,
        "maxLength": 200,
        "description": "The cron expression: 5 fields (minute hour day month weekday), or @hourly, @daily, @weekly, @monthly, @yearly"
      },
      "count": {
        "description": "The number of times, 1 to 100 (default 5)",
        "type": "integer",
        "minimum": 1,
        "maximum": 100
      },
      "after": {
        "description": "The times come after this ISO time (default now)",
        "type": "string",
        "maxLength": 100
      },
      "timeZone": {
        "type": "string",
        "minLength": 1,
        "maxLength": 100,
        "description": "The time zone of the expression: utc, local (default) or an IANA name such as Europe/Berlin"
      }
    },
    "required": [
      "cron"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "times": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "The next times as ISO texts"
      }
    },
    "required": [
      "times"
    ],
    "additionalProperties": false
  }
}