Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getNumberOfTripDays: function() {
- var startDate = this.$form.find('#qq-form-start-date').datepicker('getDate');
- var endDate = this.$form.find('#qq-form-end-date').datepicker('getDate');
- var _numOfTripDays = '';
- if (startDate && endDate) {
- // Discard the time and time-zone information.
- var MS_PER_DAY = 1000 * 60 * 60 * 24;
- var utc1 = Date.UTC(startDate.getFullYear(), startDate.getMonth(), startDate.getDate());
- var utc2 = Date.UTC(endDate.getFullYear(), endDate.getMonth(), endDate.getDate());
- var diffDays = Math.floor((utc2 - utc1) / _MS_PER_DAY);
- // dates are inclusive so add 1
- _numOfTripDays = diffDays + 1
- return _numOfTripDays;
- }
- return _numOfTripDays;
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement