diff --git a/static/js/range_calendar.js b/static/js/range_calendar.js index 545714d..4e1612c 100644 --- a/static/js/range_calendar.js +++ b/static/js/range_calendar.js @@ -148,18 +148,24 @@ function init_departure_DT() { if (!place_1) return; let hiddenTime = document.querySelector('.local_city_time').innerText; - let startDate; + let startDate = null; + if(hiddenTime){ + if (window.location.href.includes("/ru/")) { - if (window.location.href.includes("/ru/")) { + startDate = moment(hiddenTime, "D MMMM YYYY г. HH:mm", 'ru'); + } else { - startDate = moment(hiddenTime, "D MMMM YYYY г. HH:mm", 'ru'); + startDate = moment(hiddenTime, "MMMM D, YYYY, h:mm a", 'en'); + } } else { - - startDate = moment(hiddenTime, "MMMM D, YYYY, h:mm a", 'en'); + startDate = moment() } + + + $(place_1).daterangepicker({ "autoapply": true, "linkedCalendars": false, diff --git a/static/js/user_profile.js b/static/js/user_profile.js index 37a5633..f926260 100644 --- a/static/js/user_profile.js +++ b/static/js/user_profile.js @@ -350,13 +350,22 @@ function selectItemAddrPoint(id, name, ctrl_name, city_DT){ let input_list = document.getElementsByName(ctrl_name + '_list')[0]; let tap_txt_cont = document.querySelector("#id_" + ctrl_name); let local_city_time = document.querySelector(".local_city_time"); - local_city_time.innerHTML = city_DT; + + if(ctrl_name === "from_address_point_txt" && local_city_time){ + local_city_time.innerHTML = city_DT; + } + + tap_txt_cont.value = name; tap_txt_cont.setAttribute('title',name) let tap_cont = document.querySelector("#id_" + ctrl_name.slice(0, -4)); tap_cont.value = id; - init_departure_DT() + if (local_city_time){ + init_departure_DT() + init_arrival_DT() + } + if (tap_txt_cont.classList.contains('red_text')){ tap_txt_cont.classList.remove('red_text') @@ -546,12 +555,16 @@ function sendRoute(el, routeID = null){ // if (selected_owner_type[0].classList.contains('selected')){ // // }else{} - let owner_type_value = document.getElementById('hide_owner_type').value + + let hiddenTime = document.querySelector('.local_city_time').innerText; + + let owner_type_value = document.getElementById('hide_owner_type').value let form = el.form let formData = new FormData(form); let owner_type = owner_type_value formData.set('owner_type', owner_type) + formData.set('hiddenTime', hiddenTime) let url = '/routes/create_or_change_route/' if (routeID !== null){ @@ -810,8 +823,8 @@ function OnSelectionChange(el) { // } sliderInit(); - init_arrival_DT() - init_departure_DT() + // init_arrival_DT() + // init_departure_DT() diff --git a/templates/blocks/profile/b_new_route.html b/templates/blocks/profile/b_new_route.html index 36e5abb..01ad618 100644 --- a/templates/blocks/profile/b_new_route.html +++ b/templates/blocks/profile/b_new_route.html @@ -76,7 +76,7 @@
- +