-
Notifications
You must be signed in to change notification settings - Fork 79
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
Ability to only parse dates in the future #258
Comments
It's certainly not supported currently. What would be the behavior in the case of an earlier date? Return Null? Undefined? False? Throw? I'd lean towards the same behavior as non-parsable dates/invalid strings. Thoughts? |
I would say that if it would'nt match "yesterday" for instance, just return the same result as non-parsable date. What I've seen in other libraries is that you can pass a reference date to parser which could be nice. |
Well the sugar.js ones merely prefer past or future dates - they don't limit. Rather major difference. Would that be preferable or were you specifically looking for a limit? |
Well, for my specific purpose I would like to be able to limit the parsing to dates in the future. For instance, if I'm selling tickets for events, there is no point in trying to sell tickets in the past. |
Ah, yeah... that specific behavior is a fun one. Well in your case the "prefer" behavior would work best anyhow really wouldn't it? it would prefer next monday not this monday and therefore satisfy the requirements? I like the idea of the |
I'm sorry, I'm not following now. If you don't want to add |
No, I DO want to. Just clarifying that if I did and followed the Sugar,js API and behavior that that would work for you...? |
Yes, absolutely. I would gladly help but at the moment it would take to much time to just figure out the flow of the parsing and such. Do you have any idea of a time scale on this? |
Unfortunately it's not going to be very soon - I'm really the sole developer on this and have had my time taken up with paid work, and will likely be pretty swamped during the summer. |
Oh ok, well in that case I might be able to get something sorted out sooner. Kind of new to how github works, but do i just check out the code, modify and do a pull request? |
Yup! I'd highly encourage contributors! Not least because I have limited time lately. Basically you fork the repo, make the edits, add some tests, and then create a Pull Request for it. Then I can review the changes, and we can discuss any tweaks, and it can be merged into the master branch here. |
Ok, sounds solid! I'll see what I can get rolling in the next couple of days. But just to be clear, a |
Yep! One that doesn't ignore dates (you might explicitly pass a past date in) but prefers them (like in your use case of when "monday" is) |
I would like to have the possibility to set a "latest" date which the parser should match against.
For instance, if i write Sunday on a Monday, I don't want to match yesterday but next Sunday.
In my particular case i would like to only match dates in the future.
Maybe this is something that's already supported but I cant find anything in the documentation about it.
The text was updated successfully, but these errors were encountered: