Skip to content

chrono-node fails to parse date range '26 July - 22 August' as expected #604

@dev-arminder

Description

@dev-arminder

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions