DEV Community

Bracketly
Bracketly

Posted on

I Built a Cron Expression Parser Because I Kept Getting the "Day" Fields Wrong

I Built a Cron Expression Parser Because I Kept Getting the "Day" Fields Wrong

Cron syntax has five fields — minute, hour, day-of-month, month, day-of-week — and most people can read the first three just fine. 0 9 * * * is obviously "9am, every day." It's the interaction between the last two fields that trips people up, and it tripped me up enough times that I added a Cron Expression Parser to Bracketly, my free client-side dev tools site.

The gotcha: it's OR, not AND

Here's the thing that isn't obvious from staring at 0 0 1 * 1: if you read it left to right, you might assume it means "midnight, on the 1st of the month, AND on a Monday" — i.e. only fires when the 1st happens to land on a Monday.

That's wrong. Standard cron semantics say: when both day-of-month and day-of-week are restricted (neither is a bare *), a date matches if it satisfies either one. So 0 0 1 * 1 actually fires at midnight on the 1st of every month, and separately every Monday. If you wanted "only when the 1st is a Monday," cron can't directly express that at all.

This isn't a bug anywhere — it's just how POSIX cron has always worked — but it's exactly the kind of thing you forget between the few times a year you write a cron expression, and get wrong silently until a job fires on a day you didn't expect.

What the tool does

Paste a cron expression (or one of the @daily / @hourly / @weekly shortcuts) and it gives you:

  • A plain-English explanation, written to make the OR-not-AND behavior explicit rather than paper over it
  • The next 5 times the schedule will actually fire, computed from your current time
  • Inline validation — a field like 99 * * * * gets a specific "value out of range" error instead of just silently doing something unexpected

Like every tool on Bracketly, it's 100% client-side — the parsing and date math happen in your browser, nothing is sent anywhere. It supports the standard field syntax (*, ranges like 1-5, steps like */15, comma lists like 1,15), though numeric fields only for now — no MON/JAN-style names yet.

If you've ever second-guessed whether your deploy schedule actually means what you think it means, it's free and takes about ten seconds to check: bracketly.pages.dev/tools/cron-parser.

Top comments (0)