Forums

Problem with date picker

olaeblue 07 Mar, 2016
I have a table with a single record which is used to manage an end date which is editable through a form.

This works fine and has a record as follows (unique ID part obscured):
ID 1
uniq_id XXXXX97a2bbc25740c1e60632687716cc824c929
user_id 64
created 2015-01-14 07:30:43
modified 2016-03-03 16:42:21
latestdate 31-12-2017
input_submit_2 Amend Date

This is called on a form in 2 places. First to display the end date on a booking form
<?php
    $db =& JFactory::getDBO();
    $query = "
      SELECT `latestdate`
        FROM `#__chronoengine_chronoforms_datatable_HutBookingLimit`
        WHERE `uniq_id` = 'XXXXX97a2bbc25740c1e60632687716cc824c929'";
    $db->setQuery($query);
    $d = $db->loadResult();
    $Final_date = date(  "F j, Y", strtotime( $d ) );
echo "<p style=\"font-size:14px; color:Red;font-weight:bold;\">We can not yet accept bookings after " . $Final_date. ".</p>";
?>
Which correctly displays "We can not yet accept bookings after December 31, 2017."


The second time it is used to limit the last date that can be picked as follows in extra params:
data-end_date=<?php 
$db =& JFactory::getDBO();
    $query = "
      SELECT `latestdate`
        FROM `#__chronoengine_chronoforms_datatable_HutBookingLimit`
        WHERE `uniq_id` = 'XXXXX97a2bbc25740c1e60632687716cc824c929' ;
    ";
    $db->setQuery($query);
    $d = $db->loadResult();
echo $d;
?>
But the date picker stops at 31 12 2016 and all 2017 is greyed out

Any Ideas why?
GreyHead 07 Mar, 2016
Hi olaeblue,

If you look at the page HTML what is actually set in the datepicker data-end_date value?

Bob
olaeblue 11 Mar, 2016
So it's staying as 31-12-2016
<div class="gcore-input gcore-display-table" id="fin-from_date"><input name="from_date" id="from_date" value="" data-gdatetimepicker-format="d-m-Y" placeholder="" class="validate['required'] form-control A" title="" style="" data-load-state="" data-tooltip="Required.
Pick a date." type="text" data-fieldtype="gdatetimepicker" data-start_view="d" data-end_date="31-12-2016" /></div></div><div class="form-group gcore-form-row" id="form-row-end_date"><label for="end_date" class="control-label gcore-label-left">Departure Date</label>

But why when the same code correctly changes the other date and it worked fine for the last 2 years?
olaeblue 11 Mar, 2016
As a short term fix I went and put 31-12-2017 in the advanced end date filed saved and checked the page. I realised that I had only done this for one box, but when I looked at the HTML code it was now correct for both boxes?

As I have 2 paes with the same code (booking 2 different huts) I opened the second one, and then just saved and closed without doing anything. This one then started working properly.

So is this some form of compile error?? Totally baffled (though it is fixed) :?
GreyHead 11 Mar, 2016
Hi Olaeblue,

I have no clues - it sounds as though maybe something was cached?

Bob
olaeblue 11 Mar, 2016
Ok well thanks anyway
This topic is locked and no more replies can be posted.