chrono-node fails to parse date range '26 July - 22 August' as expected
Description
When parsing the string 26 July - 22 August, chrono-node does not return the expected date(s) for the range. Instead, it returns a single, incorrect date.
Minimal Reproduction
Test code:
const chrono = require("chrono-node");
const testCase = "26 July - 22 August";
const now = new Date();
console.log(`Current date: ${now.toDateString()}`);
const parsedDate = chrono.parseDate(testCase, now, { forwardDate: true });
if (parsedDate) {
console.log(`Parsed date: ${parsedDate.toDateString()}`);
console.log(`Full date: ${parsedDate.toString()}`);
} else {
console.log("❌ Could not parse date");
}
Output:
Current date: Wed Jul 02 2025
Parsed date: Fri Jul 01 2022
Full date: Fri Jul 01 2022 12:00:00 GMT+0530 (India Standard Time)
Expected Behavior
- chrono-node should either return both start and end dates for the range, or at least the correct start date (e.g., 26 July 2025 or 26 July of the current/next year).
- The current output is not correct and is confusing.
Environment
- chrono-node version: (latest)
- Node.js version: (your version)
- OS: Windows 10
Additional Notes
- Please advise if there is a workaround or if this is a known limitation.
@wanasit
chrono-node fails to parse date range '26 July - 22 August' as expected
Description
When parsing the string
26 July - 22 August, chrono-node does not return the expected date(s) for the range. Instead, it returns a single, incorrect date.Minimal Reproduction
Test code:
Output:
Expected Behavior
Environment
Additional Notes
@wanasit