Jump to content

Extended InputfieldDatetime Module Settings doesn't work correctly


Recommended Posts

Hi Guys

I needed to add extended functionalities for the InputfieldDatetime Module (module is from processwire version 2.7.3) because of a Request of Customer.
So I duplicated the module and placed it under /site/modules/.

I have added 3 new Settings to the InputfieldDatetime Module.

1. Day Restriction - Restrict different days based on weekdays selection (e.g. saturday, sunday) - WORKING


2. Time Slots - Define Time slots based on custom Integer Value (max is 60 for 1 hour) - WORKING


3. Time Range Rules per Weekday - Define a minTime and MaxTime per Weekday (e.g. Opening Hours of a Restaurant) - NOT WORKING PROPERLY


The Problem
Time Slots and Day Restriction working fine so far. But the Time Range Rules per Weekday doesn't work right.
What should happen is, that when you click on a date, it should update the minTime and maxTime of the Time Select.
But the change on the select only happens if you select a date 2 times or when you select a date 1 time and then close the datepicker and reopen it again.
The time select doesn't get change when you select a date 1 time and don't close the picker.

Here is the whole extended InputfieldDatetime Module.
The Files that I have changed:


Thats the Part of the JS that is not working correctly:

if(datetimerules && datetimerules.length){
        options.onSelect = function(date, inst) {
            var day = $(this).datetimepicker("getDate").getDay();
            day = day.toString();
            var mintime = $(this).attr('data-weekday'+day+'-mintime');
            var maxtime = $(this).attr('data-weekday'+day+'-maxtime');

            console.log("weekday: "+day);
            console.log("minTime: "+mintime);
            console.log("maxTime: "+maxtime);

            var optionsAll = $(this).datetimepicker( "option", "all" );
            optionsAll.minTime = mintime;
            optionsAll.maxTime = maxtime;






          //  var inst = $.datepicker._getInst($(this));

           // $.datepicker._updateDatepicker(inst);


            InputfieldDatetimeDatepicker($(this), mintime, maxtime); 

            $(this).datetimepicker('refresh'); */

           // $(this).datetimepicker('option', {minTime: mintime, maxTime: maxtime});

Can you have a look and find out what the Problem is?



Kind Regards

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...