Good day! The problem is that I derived the datepicker, but on the first click he chooses two dates at once, the current one and the one that was selected. How to remove this problem, tell me, please.

jQuery('#date_range').datepicker({ minDate: '+0', changeMonth: true, changeYear: true, numberOfMonths: 3, range: 'multiple', // Ρ€Π΅ΠΆΠΈΠΌ - Π²Ρ‹Π±ΠΎΡ€ Π½Π΅ΡΠΊΠΎΠ»ΡŒΠΊΠΈΡ… Π΄Π°Ρ‚ dateFormat: "dd.mm.yy", range_multiple_max: '25', // макимальноС число Π²Ρ‹Π±ΠΈΡ€Π°Π΅ΠΌΡ‹Ρ… Π΄Π°Ρ‚ onSelect: function(dateText, inst, extensionRange) { // extensionRange - ΠΎΠ±ΡŠΠ΅ΠΊΡ‚ Ρ€Π°ΡΡˆΠΈΡ€Π΅Π½ΠΈΡ jQuery('input[name=multipleDate]').val(extensionRange.datesText.join(',')); } 
  • well, turn off the multiplayer - will choose only one date - Dan the Hat
  • I need that he chose more than one date. The problem here is that only with the first click (with one click) he adds two dates at once, and not one. Then everything is fine. - Asad AsadyLlag

1 answer 1

In general, figured out how to fix it. If anyone encounters this problem, here is the working version:

 jQuery('#date').datepicker({ changeMonth: true, setDate: null, changeYear: true, numberOfMonths: 3, range: 'multiple', // Ρ€Π΅ΠΆΠΈΠΌ - Π²Ρ‹Π±ΠΎΡ€ Π½Π΅ΡΠΊΠΎΠ»ΡŒΠΊΠΈΡ… Π΄Π°Ρ‚ dateFormat: "dd.mm.yy", minDate: "+0d", onSelect: function(dateText, inst, extensionRange) { // extensionRange - ΠΎΠ±ΡŠΠ΅ΠΊΡ‚ Ρ€Π°ΡΡˆΠΈΡ€Π΅Π½ΠΈΡ jQuery('input[name=dates]').val(extensionRange.datesText.join(',')); } }); var extensionRange = jQuery('#date').datepicker('widget').data('datepickerExtensionRange'); if (extensionRange.datesText) extensionRange.datesText = [];