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

Need minDate, maxDate support please #399

Closed
momon opened this issue Apr 12, 2017 · 7 comments
Closed

Need minDate, maxDate support please #399

momon opened this issue Apr 12, 2017 · 7 comments

Comments

@momon
Copy link

momon commented Apr 12, 2017

I have noticed that when using the range_date filter I can't specify a minData and a maxDate for the form fields. In my case scenario it would ideally do it automatically based on the dates available in the table but that isn't the case.

I have temporarily enforced them by using:

$("#yadcf-filter--setstable-from-date-0").datepicker( "option", { minDate: "01/01/2017", maxDate: "31/01/2017"} );
$("#yadcf-filter--setstable-to-date-0").datepicker( "option", { minDate: "01/01/2017", maxDate: "31/01/2017"} );

This works on page load but as soon as the filter is cleared there appears to be a "reset" function that dismisses my hardcoded values.

So I'm not sure if my use scenario here is too custom but could probably be resolved by allowing to input custom minDate and maxDate on the jquery datepicker or alternatively automatically assume minDate and maxDate based on the dates in the table (which makes total sense to me).

@vedmack
Copy link
Owner

vedmack commented Apr 13, 2017

You should use filter_plugin_options (read docs) you can feed it with any options you like and it will be passed "as is" to your third party plugin, for example filter_plugin_options: {minDate: '...', maxDate: '...'} .

Next time please ask questions on stackoverflow and tag with yadcf

@momon
Copy link
Author

momon commented Apr 13, 2017

Thank you and I apologize for not seeing that before. However, after testing it, it appears to have the same bug as my own implementation (which I've since removed). After setting the entries the first time and clearing them out (reset), the start date defaults back to "today's" date which based on my settings shouldn't even be an option.

So to put it into a visual, the first time I click on the date fields, it show's my date limits fine. After resetting it, if I go back to select a start date again, the start date field defaults to today's date which is outside of my minDate and maxDate range. So I feel there is still some sort of bug with the reset operation.

@vedmack
Copy link
Owner

vedmack commented Apr 13, 2017 via email

@momon
Copy link
Author

momon commented Apr 13, 2017

Sure thing, here is the example:

https://jsfiddle.net/6n7bn2tx/

You can see when you try to select the date the first time, the range is limited (as it should) but as soon as you click the "reset" button it seems to dismiss the range and defaults the picker to "today's" date.

Please note I didn't give the example much attention other than making sure it had a date range to play with.

@vedmack vedmack reopened this Apr 18, 2017
@vedmack vedmack removed the question label Apr 18, 2017
@vedmack
Copy link
Owner

vedmack commented May 2, 2017

@momon , take a look at the following jsfiddle page it uses the newest yadcf beta (in resources), see if solves your issue and let me know

@momon
Copy link
Author

momon commented May 2, 2017

@vedmack that example does seem to be behaving as expected so looks like it's been fixed in the beta already.

Thanks!

vedmack added a commit that referenced this issue May 3, 2017
support for min/max date on range date resetIApiIndex

#399
@vedmack
Copy link
Owner

vedmack commented May 3, 2017

@momon please use the yadcf beta 0.9.2.beta.8 in case of any issue let me know

@vedmack vedmack closed this as completed May 3, 2017
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

2 participants