मैंने Jquery UI का उपयोग करके कस्टम दिनांक सीमा पिकर बनाया है।JQuery UI डेटपिकर में Google क्रोम समस्या
यह अन्य ब्राउज़र में पूरी तरह से काम करता है लेकिन Google में यह ठीक से काम नहीं करता है।
स्नैप के नीचे देखें।
लाल दौर खाली होना चाहिए, लेकिन यह कुछ पाठ हो जाता है, शायद लूप के कारण, लेकिन मैं इसे समझ नहीं सकता।
मेरे js कोड।
$(function() {
from = $("#from").datepicker({
defaultDate: "+1w",
numberOfMonths: 2,
minDate: +7, //THIS IS FIRST PLACE
autoclose: false,
beforeShow: function (input, inst) {
$("#ui-datepicker-div td").off();
$(document).on("mouseenter", "#ui-datepicker-div td", function (e) {
$(this).parent().addClass("finalRow");
$(".finalRow").parents('.ui-datepicker-group-last').parent().find('.ui-datepicker-group-first').find('tr').last().addClass("finalRowRangeOtherTable");
$(".finalRow").prevAll().find("td:not(.ui-datepicker-unselectable)").removeClass("highlight");
$(this).prevAll("td:not(.ui-datepicker-unselectable)").removeClass("highlight");
});
},
beforeShowDay: function (date) {
var d = date.getTime();
if ($("#to").datepicker("getDate") && d == $("#to").datepicker("getDate").getTime()) {
return [true, 'ui-red', ''];
}
if ($("#from").datepicker("getDate") && $("#to").datepicker("getDate") && d < $("#to").datepicker("getDate").getTime() && d > $("#from").datepicker("getDate").getTime()) {
return [true, 'ui-state-highlight', ''];
} else {
return [true, ''];
}
},
onClose: function (selectedDate) {
var selectedDate = $("#from").datepicker("getDate");
if (selectedDate != null) {
$('#to').datepicker('option', 'minDate', selectedDate).datepicker('refresh'); //THIS IS SECOND PLACE
}
$("#from").datepicker("option", "dateFormat", "d MM, yy");
$("#to").datepicker("show");
}
})
to = $("#to").datepicker({
defaultDate: "+1w",
numberOfMonths: 2,
autoclose: false,
beforeShow: function (input, inst) {
$("#ui-datepicker-div td").off();
$(document).on("mouseenter", "#ui-datepicker-div td", function (e) {
$(this).parent().addClass("finalRow");
$(".finalRow").parents('.ui-datepicker-group-last').parent().find('.ui-datepicker-group-first').find('tr').last().addClass("finalRowRangeOtherTable");
$(".finalRowRangeOtherTable").find("td:not(.ui-datepicker-unselectable)").addClass("highlight");
$(".finalRowRangeOtherTable").prevAll().find("td:not(.ui-datepicker-unselectable)").addClass("highlight");
$(".finalRow").prevAll().find("td:not(.ui-datepicker-unselectable)").addClass("highlight");
$(this).prevAll("td:not(.ui-datepicker-unselectable)").addClass("highlight");
});
$(document).on("mouseleave", "#ui-datepicker-div td", function (e) {
$(this).parent().removeClass("finalRow");
$("#ui-datepicker-div td").removeClass("highlight");
$(".finalRowRange").removeClass("finalRowRange").find('.highlight').removeClass("highlight");
$(".finalRowRangeOtherTable").removeClass("finalRowRangeOtherTable").find('.highlight').removeClass("highlight");
});
},
beforeShowDay: function (date) {
var d = date.getTime();
if ($("#from").datepicker("getDate") && d == $("#from").datepicker("getDate").getTime()) {
return [true, 'ui-red', ''];
}
if ($("#from").datepicker("getDate") && $("#to").datepicker("getDate") && d < $("#to").datepicker("getDate").getTime() && d > $("#from").datepicker("getDate").getTime()) {
return [true, 'ui-state-highlight', ''];
} else {
return [true, ''];
}
}
})
.on("change", function() {
from.datepicker("option", "maxDate", getDate(this));
$("#to").datepicker("option", "dateFormat", "d MM, yy");
});
});
मैं इसे सीएसएस के साथ मुद्दा है क्योंकि यह IE में भी अन्य ब्राउज़र पर पूरी तरह से काम करता है नहीं लगता।
मैंने यह भी पाया है कि यह तब होता है जब और जब मैं datepicker में से किसी को minDate असाइन करते हैं, अगर मैं datepicker ठीक काम करता है कि लाइनों को हटाने, जे एस कोड में मेरी टिप्पणी देखने के लिए, लेकिन जैसा कि मैंने कस्टम श्रेणी datepicker उपयोग कर रहा हूँ, मुझे उन लाइनों की आवश्यकता होगी, क्या मैं किसी अन्य विकल्प का उपयोग कर सकता हूं?
यहां बेवकूफ है। LINK
- Google Chrome में ओपन बेला
- आरंभ तिथि के रूप में चुनें 10 अक्टू
- समाप्ति तिथि के रूप में चुनें 23 अक्टू
- अब, ओपन datepicker एक के बाद एक के दोनों है, और पर होवर दिनांकों और जैसा कि मैंने स्नैप (ऊपर) में जोड़ा है, आपको अतिरिक्त तिथि दिखाई देगी ..
- मैं लाइव लिंक के सीएसएस को ओवरराइट नहीं कर सका, इसलिए डिज़ाइन थोड़ा सा दिखता है ..
क्रोम अद्यतन से पहले क्रोम 61 के साथ एक बग की तरह लगता है किया गया है प्रतीत होता है, यह ठीक काम किया। उसके बाद, मैं ओपी की समस्या देख रहा हूं। – Zyren