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

Regex Pattern needs an overhaul to make use of the full potential of custom parsers #502

Open
tahaf22labs opened this issue Feb 28, 2023 · 0 comments

Comments

@tahaf22labs
Copy link

tahaf22labs commented Feb 28, 2023

While using casual parser, if I take the documentation example, say

custom.parsers.push({
    pattern: () => { return /\bChristmas\b/i },
    extract: (context, match) => {
        return {
            day: 25, month: 12
        }
    }
});

custom.parseDate("I'll arrive at 2.30AM on Christmas night");

This works great until I want something like
I'll arrive Christmas of next year. Or Next Christmas year.
In both of the results, it wont be able to get accurate year based on my inputs, since it occurs post the pattern.
My requirement is to add Fiscal format but it needs to inherit the year based on refDate which we might get from extract's context.
In current situation, whatever I search, the refDate will return me the current Date.

@tahaf22labs tahaf22labs changed the title RefDate is broken Regex Pattern needs an overhaul to make use of the full potential of custom parsers Feb 28, 2023
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

1 participant