Click here to Skip to main content
14,390,256 members
Rate this:
Please Sign up or sign in to vote.
See more: , +
Hello everyone.
So, I am developing a web based application for an airport parking. I am using Twitter bootstrap for the form. To get the date and time range of every enquiry I am using Date Range Picker for Bootstrap. What I would like to do is to dynamically change a label's value called "Total Price" which is found in the booking page based on the Date Range Picker's inputs (located on the top). Browsing their documentation I could not find something similar to my case. The charging rates are 0.01 per hour. For example: In case I am in the process of my enquiry and I choose to drop my car off at Saturday 10 (00:00) and pick it up at Sunday 11 (00:00) the price label should display "24€".

It is my understanding that this might me too much to ask but I tried as far as I could with no result. Thank you in advance.
Updated 5-Oct-15 14:16pm

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

var startDate = "", endDate = "";

    "startDate": "09/30/2015",
    "endDate": "10/06/2015"
}, function(start, end, label) {
  //console.log("New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')");
startDate = start.format('YYYY-MM-DD');
endDate = end.format('YYYY-MM-DD');

var dateDiff = Math.abs(startDate.getTime() - endDate.getTime()) / 3600000;

// and then perform your operation based on dateDiff.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100