How to use the @microsoft/recognizers-text-data-types-timex-expression.creator.weekFromToday function in @microsoft/recognizers-text-data-types-timex-expression

To help you get started, we’ve selected a few @microsoft/recognizers-text-data-types-timex-expression 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 microsoft / BotBuilder-Samples / samples / javascript_nodejs / 40.timex-resolution / constraints.js View on Github external
module.exports.examples = () => {
    // When you give the recognzier the text "Wednesday 4 o'clock" you get these distinct TIMEX values back.
    // But our bot logic knows that whatever the user says it should be evaluated against the constraints of
    // a week from today with respect to the date part and in the evening with respect to the time part.
    const resolutions = resolver.evaluate(
        ['XXXX-WXX-3T04', 'XXXX-WXX-3T16'],
        [creator.weekFromToday(), creator.evening]
    );

    const today = new Date();

    resolutions.forEach(resolution => {
        console.log(resolution.toNaturalLanguage(today));
    });
};