How to use the chrono-node.ParsedResult function in chrono-node

To help you get started, we’ve selected a few chrono-node examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shalvah / RemindMeOfThisTweet / src / timeparser.js View on Github external
hrsMinsParser.extract = (text, ref, match, opt) => {
    let dateMoment = require('moment')(ref);
    dateMoment = dateMoment.add(match[1], 'hours');
    dateMoment = dateMoment.add(match[3], 'minutes');
    return new chrono.ParsedResult({
        ref: ref,
        text: match[0],
        index: match.index,
        start: {
            hour: dateMoment.hour(),
            minute: dateMoment.minute(),
            second: dateMoment.second(),
            day: dateMoment.date(),
            month: dateMoment.month() + 1,
            year: dateMoment.year(),
        }
    });
};

chrono-node

A natural language date parser in Javascript

MIT
Latest version published 3 days ago

Package Health Score

81 / 100
Full package analysis

Similar packages