Convert cron expressions into human readable descriptions
Overall
score
100%
Build a utility that converts standard cron expressions into human-readable descriptions. The utility should support 5-part cron expressions following the standard format: minute, hour, day-of-month, month, and day-of-week.
Your solution must:
minute hour day-of-month month day-of-weekInput: "*/5 * * * *"
Output: Should describe running every 5 minutes
Input: "30 14 * * *"
Output: Should describe running at 2:30 PM every day
Input: "0 9 * * MON-FRI"
Output: Should describe running at 9:00 AM on Monday through Friday
Input: "0 6,12,18 * * *"
Output: Should describe running at 6:00 AM, 12:00 PM, and 6:00 PM
// src/cronParser.test.js
describe('Cron Parser', () => {
it('should parse every minute expression', () => {
const result = parseCronExpression('* * * * *');
expect(result).toContain('minute');
});
});// src/cronParser.test.js
describe('Cron Parser', () => {
it('should parse specific time expression', () => {
const result = parseCronExpression('30 11 * * *');
expect(result).toContain('11:30');
});
});// src/cronParser.test.js
describe('Cron Parser', () => {
it('should parse weekday range expression', () => {
const result = parseCronExpression('0 23 * * MON-FRI');
expect(result).toContain('Monday');
expect(result).toContain('Friday');
});
});// src/cronParser.test.js
describe('Cron Parser', () => {
it('should parse step value expression', () => {
const result = parseCronExpression('*/15 * * * *');
expect(result).toContain('15');
});
});A library that provides cron expression parsing and conversion capabilities.
Install with Tessl CLI
npx tessl i tessl/npm-cronstruedocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10