A cron expression parser and schedule calculator written in MoonBit.
MoonCron parses, validates, describes, matches, builds, normalizes, and analyzes cron expressions. It also calculates previous and future matching times. It is a cron rule library and CLI; it does not execute or schedule tasks.
Features
Standard 5-field expressions: minute hour day-of-month month day-of-week
Extended 6-field expressions with seconds
Values, lists, ranges, steps, and range-with-step syntax
Seven aliases: @hourly, @daily, @midnight, @weekly, @monthly, @yearly, and @annually
Detailed validation errors
Date/time matching with cron day-of-month OR day-of-week semantics
Previous, next, bounded, and range-based execution-time queries
English and Chinese descriptions
Fluent CronBuilder and quick constructors
Normalization, equivalence checks, field set operations, and frequency analysis
CLI commands for validation, description, calculation, and matching
151 tests across Wasm, Wasm-GC, JavaScript, and Native
Supported Syntax
Syntax
Example
Meaning
Wildcard
*
Any valid value
Value
5
One specific value
List
1,3,5
Any listed value
Range
1-5
Inclusive range
Step
*/10
Every 10 values
Range + step
10-50/5
Every 5 values from 10 through 50
Field layouts:
# Standard
minute hour day-of-month month day-of-week
# Extended
second minute hour day-of-month month day-of-week
MoonCron
A cron expression parser and schedule calculator written in MoonBit.
MoonCron parses, validates, describes, matches, builds, normalizes, and analyzes cron expressions. It also calculates previous and future matching times. It is a cron rule library and CLI; it does not execute or schedule tasks.
Features
minute hour day-of-month month day-of-week@hourly,@daily,@midnight,@weekly,@monthly,@yearly, and@annuallyCronBuilderand quick constructorsSupported Syntax
*51,3,51-5*/1010-50/5Field layouts:
See docs/syntax.md for the complete syntax guide.
Installation
Add MoonCron to
moon.mod:Import it in
moon.pkg:Published package: 001-Elsa/mooncron on Mooncakes
Library Usage
Common API
The generated public interface is available in
pkg.generated.mbti.CLI Usage
Validation Errors
MoonCron returns errors that identify the invalid field and constraint:
Verification
Run the same checks used by the submission workflow:
Expected test result for each formal backend:
The
alltarget covers Wasm, Wasm-GC, JavaScript, and Native.Project Structure
Project Boundaries
MoonCron v0.1.0 intentionally does not provide:
L,W,#)Roadmap
L,W,#)License
Apache-2.0