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
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>cron.explain — Human-readable cron expressions</title>
|
| 7 |
+
<meta name="description" content="Instantly translate cron expressions to plain English. Free, fast, no signup.">
|
| 8 |
+
<style>
|
| 9 |
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
| 10 |
+
body { background: #0d1117; color: #c9d1d9; font-family: -apple-system, 'Segoe UI', monospace; min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 3rem 1rem; }
|
| 11 |
+
h1 { font-size: 2rem; margin-bottom: 0.25rem; color: #f0f6fc; }
|
| 12 |
+
.sub { color: #484f58; margin-bottom: 2rem; }
|
| 13 |
+
.input-row { display: flex; gap: 0.5rem; width: 100%; max-width: 600px; margin-bottom: 1.5rem; }
|
| 14 |
+
input { flex: 1; background: #161b22; border: 1px solid #30363d; border-radius: 6px; padding: 0.85rem 1rem; color: #f0f6fc; font-family: 'Courier New', monospace; font-size: 1.1rem; outline: none; }
|
| 15 |
+
input:focus { border-color: #58a6ff; }
|
| 16 |
+
input::placeholder { color: #484f58; }
|
| 17 |
+
.result { background: #161b22; border: 1px solid #30363d; border-radius: 8px; padding: 1.5rem; width: 100%; max-width: 600px; min-height: 80px; line-height: 1.8; }
|
| 18 |
+
.result .english { color: #58a6ff; font-size: 1.15rem; }
|
| 19 |
+
.result .detail { color: #8b949e; font-size: 0.9rem; margin-top: 0.75rem; }
|
| 20 |
+
.result .next { color: #3fb950; font-size: 0.85rem; margin-top: 0.5rem; }
|
| 21 |
+
.result .error { color: #f85149; }
|
| 22 |
+
.examples { margin-top: 2rem; width: 100%; max-width: 600px; }
|
| 23 |
+
.examples h3 { color: #484f58; font-size: 0.85rem; margin-bottom: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; }
|
| 24 |
+
.ex { display: inline-block; background: #161b22; border: 1px solid #21262d; border-radius: 4px; padding: 0.35rem 0.65rem; margin: 0.2rem; cursor: pointer; font-size: 0.85rem; color: #8b949e; font-family: monospace; }
|
| 25 |
+
.ex:hover { border-color: #58a6ff; color: #58a6ff; }
|
| 26 |
+
.footer { margin-top: 3rem; color: #30363d; font-size: 0.75rem; text-align: center; }
|
| 27 |
+
.footer a { color: #484f58; text-decoration: none; }
|
| 28 |
+
</style>
|
| 29 |
+
</head>
|
| 30 |
+
<body>
|
| 31 |
+
<h1>cron.explain</h1>
|
| 32 |
+
<p class="sub">Paste a cron expression. Get English.</p>
|
| 33 |
+
|
| 34 |
+
<div class="input-row">
|
| 35 |
+
<input id="cron" type="text" placeholder="*/5 * * * *" autofocus>
|
| 36 |
+
</div>
|
| 37 |
+
<div class="result" id="result">
|
| 38 |
+
<span class="english">Type a cron expression above</span>
|
| 39 |
+
</div>
|
| 40 |
+
|
| 41 |
+
<div class="examples">
|
| 42 |
+
<h3>Try these</h3>
|
| 43 |
+
<span class="ex" onclick="tryEx('*/5 * * * *')">*/5 * * * *</span>
|
| 44 |
+
<span class="ex" onclick="tryEx('0 9 * * 1-5')">0 9 * * 1-5</span>
|
| 45 |
+
<span class="ex" onclick="tryEx('0 0 1 * *')">0 0 1 * *</span>
|
| 46 |
+
<span class="ex" onclick="tryEx('30 4 * * SUN')">30 4 * * SUN</span>
|
| 47 |
+
<span class="ex" onclick="tryEx('0 */2 * * *')">0 */2 * * *</span>
|
| 48 |
+
<span class="ex" onclick="tryEx('15 10 * * 1,3,5')">15 10 * * 1,3,5</span>
|
| 49 |
+
<span class="ex" onclick="tryEx('0 0 * * *')">0 0 * * *</span>
|
| 50 |
+
<span class="ex" onclick="tryEx('5 4 * * SUN')">5 4 * * SUN</span>
|
| 51 |
+
</div>
|
| 52 |
+
|
| 53 |
+
<div class="footer">
|
| 54 |
+
Built by Atreus — March 23, 2026<br>
|
| 55 |
+
<a href="http://localhost:8889">Play "Two Terminals"</a>
|
| 56 |
+
</div>
|
| 57 |
+
|
| 58 |
+
<script>
|
| 59 |
+
const DAYS = {0:'Sunday',1:'Monday',2:'Tuesday',3:'Wednesday',4:'Thursday',5:'Friday',6:'Saturday',7:'Sunday',SUN:'Sunday',MON:'Monday',TUE:'Tuesday',WED:'Wednesday',THU:'Thursday',FRI:'Friday',SAT:'Saturday'};
|
| 60 |
+
const MONTHS = {1:'January',2:'February',3:'March',4:'April',5:'May',6:'June',7:'July',8:'August',9:'September',10:'October',11:'November',12:'December'};
|
| 61 |
+
|
| 62 |
+
function tryEx(v) { document.getElementById('cron').value = v; explain(); }
|
| 63 |
+
|
| 64 |
+
document.getElementById('cron').addEventListener('input', explain);
|
| 65 |
+
|
| 66 |
+
function explain() {
|
| 67 |
+
const val = document.getElementById('cron').value.trim();
|
| 68 |
+
const el = document.getElementById('result');
|
| 69 |
+
if (!val) { el.innerHTML = '<span class="english">Type a cron expression above</span>'; return; }
|
| 70 |
+
|
| 71 |
+
const parts = val.split(/\s+/);
|
| 72 |
+
if (parts.length < 5 || parts.length > 6) {
|
| 73 |
+
el.innerHTML = '<span class="error">Expected 5 fields: minute hour day-of-month month day-of-week</span>';
|
| 74 |
+
return;
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
try {
|
| 78 |
+
const [min, hour, dom, month, dow] = parts;
|
| 79 |
+
const phrases = [];
|
| 80 |
+
|
| 81 |
+
// Minute
|
| 82 |
+
if (min === '*') phrases.push('every minute');
|
| 83 |
+
else if (min.startsWith('*/')) phrases.push(`every ${min.slice(2)} minutes`);
|
| 84 |
+
else if (min.includes(',')) phrases.push(`at minutes ${min}`);
|
| 85 |
+
else if (min.includes('-')) phrases.push(`minutes ${min}`);
|
| 86 |
+
else phrases.push(`at minute ${min}`);
|
| 87 |
+
|
| 88 |
+
// Hour
|
| 89 |
+
if (hour === '*') { /* already covered */ }
|
| 90 |
+
else if (hour.startsWith('*/')) phrases.push(`every ${hour.slice(2)} hours`);
|
| 91 |
+
else if (hour.includes(',')) phrases.push(`during hours ${hour}`);
|
| 92 |
+
else if (hour.includes('-')) phrases.push(`between ${fmtHour(hour.split('-')[0])} and ${fmtHour(hour.split('-')[1])}`);
|
| 93 |
+
else phrases.push(`at ${fmtHour(hour)}`);
|
| 94 |
+
|
| 95 |
+
// Day of month
|
| 96 |
+
if (dom !== '*') {
|
| 97 |
+
if (dom.startsWith('*/')) phrases.push(`every ${dom.slice(2)} days`);
|
| 98 |
+
else if (dom.includes(',')) phrases.push(`on days ${dom} of the month`);
|
| 99 |
+
else phrases.push(`on day ${dom} of the month`);
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
// Month
|
| 103 |
+
if (month !== '*') {
|
| 104 |
+
if (month.includes(',')) phrases.push(`in ${month.split(',').map(m => MONTHS[m] || m).join(', ')}`);
|
| 105 |
+
else if (month.includes('-')) { const [a,b] = month.split('-'); phrases.push(`from ${MONTHS[a]||a} through ${MONTHS[b]||b}`); }
|
| 106 |
+
else phrases.push(`in ${MONTHS[month] || month}`);
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
// Day of week
|
| 110 |
+
if (dow !== '*') {
|
| 111 |
+
if (dow.includes('-')) {
|
| 112 |
+
const [a,b] = dow.split('-');
|
| 113 |
+
phrases.push(`${DAYS[a]||a} through ${DAYS[b]||b}`);
|
| 114 |
+
} else if (dow.includes(',')) {
|
| 115 |
+
phrases.push(`on ${dow.split(',').map(d => DAYS[d]||d).join(', ')}`);
|
| 116 |
+
} else {
|
| 117 |
+
phrases.push(`on ${DAYS[dow] || 'day ' + dow}`);
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
// Build English
|
| 122 |
+
let english = phrases.join(', ');
|
| 123 |
+
english = english.charAt(0).toUpperCase() + english.slice(1);
|
| 124 |
+
|
| 125 |
+
// Friendly summary
|
| 126 |
+
let summary = '';
|
| 127 |
+
if (min === '0' && hour === '0' && dom === '*' && month === '*' && dow === '*') summary = 'Once a day at midnight';
|
| 128 |
+
else if (min === '0' && hour === '*') summary = 'Once every hour, on the hour';
|
| 129 |
+
else if (min.startsWith('*/') && hour === '*' && dom === '*') summary = `Every ${min.slice(2)} minutes, around the clock`;
|
| 130 |
+
else if (min !== '*' && hour !== '*' && dow !== '*' && dom === '*') summary = `A weekly schedule`;
|
| 131 |
+
else if (dom !== '*' && month === '*') summary = 'Monthly schedule';
|
| 132 |
+
|
| 133 |
+
let html = `<div class="english">${english}</div>`;
|
| 134 |
+
if (summary) html += `<div class="detail">${summary}</div>`;
|
| 135 |
+
|
| 136 |
+
el.innerHTML = html;
|
| 137 |
+
} catch(e) {
|
| 138 |
+
el.innerHTML = `<span class="error">Could not parse: ${e.message}</span>`;
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
function fmtHour(h) {
|
| 143 |
+
const n = parseInt(h);
|
| 144 |
+
if (isNaN(n)) return h;
|
| 145 |
+
if (n === 0) return '12:00 AM (midnight)';
|
| 146 |
+
if (n === 12) return '12:00 PM (noon)';
|
| 147 |
+
if (n < 12) return `${n}:00 AM`;
|
| 148 |
+
return `${n-12}:00 PM`;
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
// Auto-explain if something's in the box
|
| 152 |
+
explain();
|
| 153 |
+
</script>
|
| 154 |
+
</body>
|
| 155 |
+
</html>
|