jQuery date picker plug-in
插段广告:我在项目中手动修改了date.js使其汉化(其实可以用下面的汉化包的),并且修改了日期显示格式为yyyy-DD-mm,这个时候,如果使用设置显示的开始日期(startDate)或者结束日期(endDate)就一定要使用这个格式的日期字符串,如$(".date-pick").dpSetStartDate("1970-01-01");,否则,设置不会起作用。
A flexible unobtrusive calendar component for jQuery
Welcome to the homepage for version 2 of the jQuery datePicker plugin.
This is an clean, unobtrusive plugin for jQuery which allows you to easily add date inputing functionality to your web forms and pages. Designed from the ground up to be flexible and extensible, the date picker can be used in unlimited ways to allow you to add calendar widgets to your pages.
Requirements
-
jQuery .
- The date methods .
- Optionally the bgiframe plugin (if you have SELECT elements on your page and don't want them to shine through the date pickers for users of IE).
- Optionally some localised date methods (if you want to display the date picker in a different language/ locale).
Note about using with older versions of jQuery
The datePicker is compatible with jQuery 1.1+. However, to use it with versions lower than 1.2.1 introduces a dependancy on the dimensions plugin . You will need to use a version of the dimensions plugin pre- 1.2 as in version 1.2 the offset method that we rely on was removed from the plugin (as it now exists in the core). You are always recommended to use the latest version of jQuery anyway.
Download
The latest version of the date picker will always be available through the googlecode project downloads page , alternatively you can download it below. Note that the downloads page contains the latest stable release while the subversion repository and link below will contain a newer development version.
Usage
Simply reference the relevant files at the head of your page like so:
<!-- jQuery -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<!-- required plugins -->
<script type="text/javascript" src="scripts/date.js"></script>
<!--[if IE]><script type="text/javascript" src="scripts/jquery.bgiframe.js"></script><![endif]-->
<!-- jquery.datePicker.js -->
<script type="text/javascript" src="scripts/jquery.datePicker.js"></script>
(note that I am using IE's conditional compilation to include the bgiframe plugin as it isn't necessary for other browsers so it seems pointless for them to download it)
Then simply instantiate the date picker as you like - see the demos below for inspiration...
Documentation
The inline documentation is available as a nicely formated html documentation file thanks to Jörn Zaefferer's jQuery HTML Documentation Generator
Demos
A picture is worth a thousand words and so is a demo! So here are a bunch of demos showing some of the many ways that you can use the datePicker plugin. Some of the demos are very simple and just illustrate one optional parameter while some are more complicated and illustrate completely different ways of using the plugin.
simple datePicker
A simple example showing the basic use of a date picker tied to an input field.
simple datePicker with today selected
A simple example showing the basic use of a date picker tied to an input field with todays date selected by default.
simple datePicker with dates in the past selectable
A simple example showing the basic use of a date picker tied to an input field with dates in the past selectable.
simple datePicker with ONLY dates in the past selectable
A simple example showing the basic use of a date picker tied to an input field with only dates in the past selectable (e.g. for entering birthdate).
simple inline datePicker
An example showing an inline date picker (which is always on the page and doesn't disappear).
datePicker showing selectWeek functionality
An example of the selectWeek functionality which is available on the date picker.
datePicker with position
This example shows how you can control where (relative to the associated element) the date picker appears.
datePicker with a clickable input field
An very simple example showing how you can make the date picker pop up when you click on the input field (rather than the associated button).
datePicker with a different dateFormat
A very simple example showing how you can change the date format and first day of the week displayed for the date picker.
Localised datePicker
A very simple example showing how you can localise the date picker.
disabling the datePicker
A simple example showing how you can disable a date picker.
datePicker with custom listener
This example shows how you can bind a date picker to any element and register a event listener which is informed whenever a date is selected.
datePicker with a custom cell renderer
This demo shows how you can have a date picker with a custom cell renderer to change the appearance and behaviour (in this case I make the weekends look different and be unselectable).
datePicker with multiple months visible at once
This shows how you can use the datePickerMultiMonth plugin to extend datePicker to show mulitple months at once.
datePicker with multiple months visible at once hooked into a form
This shows how you can use the datePickerMultiMonth plugin and grab it's data from a form on page load and save it to a form when it changes.
datePicker with multiple months visible at once (popup edition)
This shows how you can use the datePickerMultiMonth plugin to create popup date pickers which show mulitple months at once.
datePicker with multiple select
This shows the simple script necessary to use the date picker to be able to select multiple dates.
datePicker with multiple select and a limit on the number of selectable dates
Extends the previous example and shows how you can limit the amount of dates that can be selected when selectMultiple is true.
Start and end date pickers
This example shows how you can tie two date pickers together so that the date selected in one influences the dates that can be selected in the other.
datePicker linked to select elements
An example showing how you can bind a date picker to three select elements rather than to an input.
datePicker which disappears on mouse out
An example showing how you can make the date picker automatically close when the user moves their mouse out of it.
Date picker that appears/ disappears on focus/ blur
This example shows how you can make a date picker appear when it's related element is focused and then disappear when the relevant element is blurred.
complex inline datePicker
An example showing more advanced use of an inline date picker (with multiple instances on the same page with different settings).
more complex inline datePicker
An example showing inline date pickers which are linked together and trigger behaviour in each other...
datePicker Karmas Agent example
An example as a result of a support request from "Karmas Agent" - demonstrates custom listeners, custom date ranges and hiding dates which aren't part of the current month.
renderCalendar
The date picker also exposes a method for rendering a month view calendar into any element.
renderCalendar with callbacks
You can optionally use callbacks when rendering a calendar to control the look and behaviour of the rendered calendar.
renderCalendar displaying bank holidays
This example shows how you can use the renderCalendar callbacks to add extra data to the rendered calendar (in this case bank holidays are marked)
datePicker multi-month
[Deprecated] This shows how you can create your own datepicker which shows two consecutive months by building on top of the datePicker plugin.
Donate
My jQuery date picker is completely open source and free of charge but if you find it useful and it saves you time then please consider donating to my beer fund using the button below. Thanks!
Support
Support is available through the issues list on the jquery datepicker googlecode project - please request help or submit any bug reports there.
Credits
Thanks to John Resig and the other members of the jQuery developement team for an awesome library.
Further thanks to Brandon Aaron for the bgiframe plugin and to Brandon and Paul Bakaus for the dimensions plugin.
And a big thanks to Jörn Zaefferer for feedback during the planning stage and code review. Also to Brandon Aaron and Paul McLanahan for their input.
相关推荐
daterangepicker是一款广泛应用于网页开发中的时间范围选择插件,它基于JavaScript库jQuery,为用户提供直观、易用的日期和时间范围选择功能。在网页中集成daterangepicker,可以极大地提升用户体验,尤其是在需要...
**jQuery Date Range Picker** 是一个基于JavaScript库jQuery的日期范围选择插件,它允许用户在网页上方便地选择两个日期之间的范围。这个插件对于那些需要处理时间区间,如预订系统、数据分析或报告生成等场景非常...
**jQuery-UI-Date-Range-Picker-Plugin-Daterange** 这个文件名可能指的是这个插件的源代码包,包含了插件的JavaScript文件、CSS样式表、示例代码和可能的文档。开发者在下载后,可以参考其中的示例和文档来快速理解...
"date-picker 基本jquery的时间插件"是一款在网页中用于输入日期的jQuery插件,它极大地简化了用户在Web应用中选择日期的过程。这款插件提供了多种操作模式,适用于各种网页场景,如预订系统、日历应用等,使得日期...
总结起来,这个修改后的`simple jQuery date-picker plugin`不仅保留了原有的易用性,还增加了中文支持、点击`div`显示和回调函数等功能,为开发者提供了更多的灵活性和便利性,适用于各种类型的Web应用。...
daterangepicker插件的核心技术主要基于JavaScript库,如jQuery或更现代的React、Vue等前端框架,结合CSS样式来实现动态交互效果。它通常具有以下关键特性: 1. **日期范围选择**:用户可以方便地选择一个日期范围...
bootstrap 时间控件 daterangepicker 使用方法及各种小 bug 修复 Bootstrap 的时间控件 daterangepicker 是一个功能强大且灵活的日期选择器插件,它可以帮助开发者快速实现日期选择功能。下面将详细介绍 daterange...
本文将详细探讨基于jQuery的双日历插件pickerDateRange的修改版,以及如何在项目中有效地利用它。 首先,我们要了解jQuery双日历插件pickerDateRange的主要功能。这个插件允许用户选择一个日期范围,通常用于预订...
daterangepicker是一款广泛应用于Web开发中的日期选择插件,尤其在Bootstrap框架中十分流行。它允许用户选择一个日期范围,提供了一种直观、便捷的方式来处理日期输入。在标题中提到的"daterangepicker双时间控件"是...
在实际开发中,"pickerDateRange"可能会与各种JavaScript库或框架结合,如jQuery、Vue.js、React等,以实现更复杂的交互逻辑和更丰富的功能。开发者需要了解这些库的基本使用,以便将时间插件集成到他们的项目中。 ...
"Format Date with Date Picker using Jquery.zip"这个资源显然提供了一个使用jQuery和日期选择器来格式化日期的示例。在这个场景中,我们将探讨如何使用jQuery UI的日期选择器插件来实现日期选择功能,并对选中的...
《全面解析jQuery日期插件jquery-date.js及其在H5中的应用》 在现代网页开发中,日期选择器是不可或缺的一部分,特别是在处理用户输入日期或时间的场景。jQuery日期插件`jquery-date.js`是一个功能强大的工具,专为...
Bootstrap-daterangepicker 是一个高度可定制且功能丰富的日期范围选择插件,它建立在流行的前端框架 Bootstrap 之上。这个插件允许用户在网页上方便地选取一个日期范围,通常用于筛选数据或者设置时间跨度,比如在...
"pickerDateRange"这个时间插件,正如其名,很可能是用来选择日期范围的,它可以帮助用户在界面上方便地设定一个起始日期和结束日期。这类插件在各种需要日期范围输入的应用场景中非常实用,比如预订系统、数据分析...
在压缩包"jQuery日期时间范围选择插件"中,应该包含了daterangepicker.js脚本文件,以及可能的CSS样式表和示例HTML文件,帮助开发者快速集成和理解如何使用这个插件。 为了在项目中使用daterangepicker.js,开发者...
- 作为一个小型的日期选择器,`tiny-date-picker`提供了高度的可定制性,允许开发者根据项目需求自定义样式、行为和功能,以满足各种不同的用户体验需求。 3. **API接口**: - 项目通常会提供一套API接口,允许...
在本示例中,"daterangepicker时间组件"提供了带有和不带区间选择的两种模式,并且在选中后会显示当前日期。下载后的文件可以直接在项目中使用,简化了开发过程。为了实现这些功能,开发者可能需要对HTML、CSS以及...
1. **JavaScript交互**:daterangepicker组件的核心在于JavaScript,通常使用jQuery库或者其他类似的库来实现事件监听和逻辑处理。JavaScript负责处理用户的选择,更新显示的日期范围,并可能与后台进行数据交互,如...
在IT领域,"date-picker"通常指的是一个允许用户在用户界面中选择日期的组件,广泛应用于各种Web和移动应用中,如日历应用、预订系统、报表工具等。下面我们将深入探讨"date-picker"及其梯度依赖的相关知识点。 ...