jquery datepicker自动提前结束日期

时间:2016-02-04 16:10:00

标签: jquery datepicker jquery-ui-datepicker

我正在使用jQuery日期选择器,并希望using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO.Ports; namespace FieldProbe { public partial class MainForm : Form { private SerialPort port; public MainForm() { InitializeComponent(); } private void MainForm_Load(object sender, EventArgs e) { var ports = SerialPort.GetPortNames(); cmbSerialPorts.DataSource = ports; } private void btnConnect_Click(object sender, EventArgs e) { if (btnConnect.Text == "Connect") { btnConnect.Text = "Disconnect"; if (cmbSerialPorts.SelectedIndex > -1) { MessageBox.Show(String.Format("You selected port '{0}'", cmbSerialPorts.SelectedItem)); Connect(cmbSerialPorts.SelectedItem.ToString()); } else { MessageBox.Show("Please select a port first"); } } else { btnConnect.Text = "Connect"; port.Close(); } } private void Connect(string portName) { port = new SerialPort(portName); if (!port.IsOpen) { port.BaudRate = 921600; port.DataBits = 8; port.StopBits = StopBits.One; port.Parity = Parity.None; port.Handshake = Handshake.None; port.Open(); } } private void OtherFunction() { if (port == null || !port.IsOpen) return; // HERE DO WHATEVER YOU WANT WITH port } } } end date

自动前进1天

到目前为止,我已经获得了以下代码并且它几乎正常工作,只是没有在日期中添加+1:

start date

这是此处和其他地方的信息组合,但我似乎无法完成它。我还要求保留$(function() { $( "#datepicker-8" ).datepicker({ prevText:"click for previous months", nextText:"click for next months", showOtherMonths:true, selectOtherMonths: false, dateFormat:"dd-mm-yy", onClose: function( selectedDate ) { $( "#datepicker-9" ).datepicker( "option", "minDate", selectedDate ); var fecha = $(this).datepicker('getDate'); $("#datepicker-9").datepicker("setDate", new Date(fecha.getTime())); $("#datepicker-9").datepicker("setDate", "+1d"); } }); $( "#datepicker-9" ).datepicker({ prevText:"click for previous months", nextText:"click for next months", defaultDate: "+1d", dateFormat:"dd-mm-yy", onClose: function( selectedDate ) { $( "#datepicker-8" ).datepicker( "option", "maxDate", selectedDate ); } }); }); minDate功能,但这些功能运行良好。

非常感谢

1 个答案:

答案 0 :(得分:0)

试试这个

Indexable

这是一个有效的fiddler