Link to home
Start Free TrialLog in
Avatar of Neil_Bradley
Neil_BradleyFlag for New Zealand

asked on

Bootstrap Datetimepicker 3 lined picker heilight

Hi EE,
please see JS Fiddle here which showns a standard "Linked Picker" as described on the Bootstrap 3 datetime picker website.
My aim and what I need a hand with is to highlight the date selected on the first picker on the second calendar.
I.E. If I select the 31of May on the first picker then this date will be highlighted on the second.

Thanks for reviewing.
NB
Avatar of Bill Prew
Bill Prew

Seems like it should be as easy as below, but doesn't seem to work.  Not sure if this might be an issue, haven't searched them all...

      $("#datetimepicker6").on("dp.change", function(e) {
        $('#datetimepicker7').data("DateTimePicker").defaultDate(e.date);
      });

Open in new window


»bp
This seems to work for me:

      $("#datetimepicker6").on("dp.change", function(e) {
        $('#datetimepicker7').data("DateTimePicker").date(e.date);
      });

Open in new window


»bp
your code works fine...

you set min and max values... this is what linked calendar means...
Avatar of Neil_Bradley

ASKER

Hi Bill and thanks for your input.
For reference here is an updated fiddle https://jsfiddle.net/beaconhill/vwp3y6ao/28/
On change or focus of the first field its date appears in the second field. The issue now is that if I then go back and update the first date again then my second date updates to become once again the contents of the first..
N
I fixed your fiddle above

https://jsfiddle.net/9tr0f6xp/

it should work as this one...
The problem still persists.
Update the first picker after the second has been selected and the second date changes too. This will be extremely annoying to the user who simply wants to update the first date and not have the second change too.

Should be
if datepicker7 contains a value then don't do anything if datepicker6 changes to a date that is equal to or less that that of datepicker7
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You beaut!
Perfect and thanks for sticking with me.
Best.
Neil
Welcome Neil, glad I was able to help.


»bp