javascript - If before a certain hour block a day -


i'm trying trigger in code written me cant seem work.

what need have date picker block out today , before today if before 11am , block out tomorrow , before if after 11am. trying put if/else on mindate in code below no joy.

i assuming can code found in post:

var currenttime = new date(); var starttime = new date(); starttime.sethours(00); starttime.setminutes(00); var endtime = new date(); endtime.sethours(11); endtime.setminutes(00);  if ((currenttime.gettime() > starttime.gettime()) && (currenttime.gettime() < endtime.gettime()) {    mindate: 2 } else {    mindate: 3; } 

but everytime try put code below break it. can please help?

.jquery(".dpicker").datepicker( {     mindate: 2,     onselect: function(datetext, inst)     {         var date = jquery(this).val();         jquery('#frm_field_263_container').hide();         jquery('#frm_field_263_container').after(             '<img id="loading" src="loading30.gif" />'         );         jquery('#frm_field_265_container').hide();         var qantity;         if (!jquery('#field_6pc0y').val())         {             qantity = 0;         }         else         {             qantity = parseint(jquery('#field_6pc0y').val());         }         jquery.post(frm_js.ajax_url,         {             'action': 'order_quantity',             'pick_up_date': jquery('#field_mv0ti').val(),             'product_id': jquery('#product_id').val(),             'product_title': jquery('#product_title').val()         }, function(response)         {             stock = parseint(response);             jquery('#field_navpp').val(response - qantity);             jquery('#loading').hide();             jquery('#frm_field_263_container').show();             if (response - qantity < 0)             {                 jquery('#frm_field_265_container').show();             }         });     },     dateformat: 'yy-mm-dd',     changemonth: true,     changeyear: true }); 

: used in object literal when assigning properties or goto label; want store mindate in variable can use when creating date picker:

var mindate; var currenttimestamp = currenttime.gettime(); if (currenttimestamp > starttime.gettime() && currenttimestamp < endtime.gettime()) {    mindate = 2; } else {    mindate = 3; }  jquery(".dpicker").datepicker({   mindate: mindate,   // etc... }); 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -