You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the current implementation, the strict parser makes sure that all the tokens are used and they consume all the text, but the tokens themselves are still forgiving. For example, "YYYY" matches 1-4 digits.
@ichernev - you mentioned once that we might want separate token definitions for strict. What do you think?
Well, if we want to move forward from a hacky implementation that sort of works to something better, yes, we do need separate tokens. I'm pretty sure there was a reason why not to use parse -> format -> check for equality, but I can think about one right now.
Activity
icambron commentedon Oct 16, 2013
In the current implementation, the strict parser makes sure that all the tokens are used and they consume all the text, but the tokens themselves are still forgiving. For example, "YYYY" matches 1-4 digits.
@ichernev - you mentioned once that we might want separate token definitions for
strict. What do you think?ichernev commentedon Oct 16, 2013
Well, if we want to move forward from a hacky implementation that sort of works to something better, yes, we do need separate tokens. I'm pretty sure there was a reason why not to use parse -> format -> check for equality, but I can think about one right now.
icambron commentedon Oct 17, 2013
I just meant having alternative versions of
parseTokenFourDigitsand company.dmahapatro commentedon Oct 17, 2013
FYR: Corresponding jsfiddle
dmahapatro commentedon Oct 17, 2013
Current workaround:
Comment if there is anything simpler.
johnstrickler commentedon Oct 23, 2013
Here's an alternative workaround (less robust but simpler):