Default the search date picker to another month

WordPress Event Management, Calendars & Registration Forums General Question Default the search date picker to another month

This topic contains 5 replies, has 2 voices, and was last updated by  Stephen Harris 9 years, 8 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #17410

    Hi, Is it possible to default the date picker to another month?
    I’m talking about the search widget.
    I have a special calendar of events and all of my events are only held on Sept and Oct.

    So is it also possible to only have Sept & Oct on the calendar grid view?

    Please let me know.

    Thanks

    Mehrdad Emami
    #17443

    Hi Mehrdad,

    Yes, but this would involve editing the plug-in files, specifically js/event-search.js – I should point out that it is the .min.js version you actually need to edit, but minified files are not fun to edit :), so I’d recommend editing the non-minified one, copying it across (and optionally minifying it again).

    The file does nothing else than instantiate the datepicker, and you can use the settings here listed here: http://api.jqueryui.com/datepicker/. I think you need defaultDate option and the minDate and maxDate options.

    Stephen Harris
    #17455

    Thanks for the info. I looked at the documentation link and also the following lines of cod in the js file:

    data(“range”)?”minDate”:”maxDate”,d=a(this).data(“datepicker”),e=a.datepicker

    However I wasn’t able to understand how to change the code to:

    $( “.selector” ).datepicker({
    defaultDate: +9
    });

    Could you be more specific please?

    Thanks a lot.

    Mehrdad Emami
    #17475

    Don’t edit the .min.js version directly – it would be a nightmare to decipher it. If you open the js/event-search.js, then you’ll see the .datepicker({...}) call and can just add in your option.

    Stephen Harris
    #17478

    It worked! but looks like it doesn’t do exactly what I want.

    I added this:
    defaultDate: +100

    But if I’m understanding correctly it is counting 100 days from today so it is showing Septmeber now. It will be changed every day.
    I want to have September as the default start date picker at all times.

    Any idea?

    Thanks

    Mehrdad Emami
    #17480

    That’s correct. You can specify a particular date using a JavaScript date object or a formatted date in the format of the datepicker (e.g. '2015-09-01' for the 1st September)

    Stephen Harris
Viewing 6 posts - 1 through 6 (of 6 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.