简体   繁体   English

多个日期选择器JavaScript

[英]Multiple date picker javascript

I want to create an input form to allow a user to add the monthly recurring item in my application. 我想创建一个输入表单,以允许用户在我的应用程序中添加每月重复发生的项目。 The user can pick multiple dates from the month. 用户可以从一个月中选择多个日期。 After I googling I found AlloyUi datepicker using multiple type. 谷歌搜索后,我发现使用多种类型的AlloyUi datepicker

My questions are : 我的问题是:

  1. How to multiple select without press control? 如何在没有按下控制的情况下进行多重选择? Currently, if click without control on another day will remove all other days. 当前,如果在另一天点击无控制,则会删除所有其他日期。
  2. How to change input box to the only date after picked, so example return will be "Every 2nd, 10th, 28th every month". 如何将输入框更改为选择后的唯一日期,因此示例返回将为“每月第二,十,二十八”。
  3. Any other library that fit in my case? 还有其他适合我的库吗?

 YUI().use( 'aui-datepicker', function(Y) { new Y.DatePicker({ trigger: 'textarea', mask: '%m/%d/%y', calendar: { selectionMode: 'multiple' }, popover: { zIndex: 1 }, panes: 1 }); }); 
 <link href="http://cdn.alloyui.com/3.0.1/aui-css/css/bootstrap.min.css" rel="stylesheet" /> <script src="http://cdn.alloyui.com/3.0.1/aui/aui-min.js"></script> <textarea class="form-control" type="text" placeholder="mm/dd/yy">09/07/18 — 09/08/18 — 09/19/18</textarea> 

This looks promising for your purpose. 对于您的目的,这看起来很有希望。 see the demo link below: 请参阅下面的演示链接:

var today = new Date();
var y = today.getFullYear();
$('#mdp-demo').multiDatesPicker({
addDates: ['10/14/'+y, '02/19/'+y, '01/14/'+y, '11/16/'+y],
numberOfMonths: [3,4],
defaultDate: '1/1/'+y
});

it serves your requirements: 它满足您的要求:

  • How to multiple select without press control? 如何在没有按下控制的情况下进行多重选择? Currently, if click without control on another day will remove all other days. 当前,如果在另一天点击无控制,则会删除所有其他日期。
  • How to change input box to the only date after picked, so example return will be "Every 2nd, 10th, 28th every month". 如何将输入框更改为选择后的唯一日期,因此示例返回将为“每月第二,十,二十八”。 // you will have to work on it. //您将不得不对其进行操作。 see doc link below: 请参阅下面的文档链接:

demo link: http://dubrox.github.io/Multiple-Dates-Picker-for-jQuery-UI/#demo-full-year 演示链接: http : //dubrox.github.io/Multiple-Dates-Picker-for-jQuery-UI/#demo-full-year

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM