Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing returns different results if date is embedded in text or not #317

Closed
dylanlingelbach opened this issue Jan 16, 2020 · 1 comment
Closed

Comments

@dylanlingelbach
Copy link

When trying to bump our version of chrono-node our automated tests caught a change in behavior. After trying a few things it appears this is an unexpected regression and bug.

Link to repro in RunKit: https://runkit.com/dylanlingelbach/5e20a37b87a30d001bf04503

Code:

var chronoNode142 = require("chrono-node"); // version 1.4.2
var chronoNode1311 = require("chrono-node@1.3.11");
function testParse (chronoNode) {
    var chrono = new chronoNode.Chrono();
    var text = `
                    He will be leaving on July 28 2017 at 6:34pm.
                    I'm certain that I will be very sad once he leaves, around 07-28-17 18:35.
                `;
    var results = chrono.parse(text);
    var singleResult = chrono.parse('07-28-17 18:35');

    if (results[1].start.knownValues.year !== singleResult[0].start.knownValues.year) {
      throw new Error('Unexpected results');
    }
}

testParse(chronoNode1311);
console.log('Version 1.3.11 passed');
testParse(chronoNode142); // Exception thrown here
console.log('Version 1.4.2 passed');
@wanasit
Copy link
Owner

wanasit commented Feb 9, 2020

Thanks for letting me know. Could you try again in 1.4.3?

@wanasit wanasit closed this as completed Feb 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants