--- /dev/null
+<?php
+/**
+ * Plugin Name: GLM Timecard
+ * Plugin URI: http://www.gaslightmedia.com
+ * Description: For managing GLM timecards
+ * Version: 0.0.1
+ * Author: GLM
+ * Author URI: http://www.gaslightmedia.com
+ */
+
+
+define('GLM_TIMECARD_PLUGIN_URL', plugin_dir_url(__FILE__) );
+?>
+<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
+<script src="<?php echo GLM_TIMECARD_PLUGIN_URL; ?>js/timepicker/jquery.timepicker.min.js" type="text/javascript"></script>
+<link rel="stylesheet" type="text/css" href="<?php echo GLM_TIMECARD_PLUGIN_URL; ?>js/timepicker/jquery.timepicker.css" media="screen" />
+
+
+
+
+<script type="text/javascript" src="<?php echo GLM_TIMECARD_PLUGIN_URL; ?>js/datepair/dist/datepair.js"></script>
+<?php
+
+
+echo plugin_dir_url(__FILE__)."js/timepicker/jquery.timepicker.min.js";
+
+add_action('admin_menu', 'my_plugin_menu');
+
+$days = [
+ 'monday',
+ 'tuesday',
+ 'wednesday',
+ 'thursday',
+ 'friday',
+ 'saturday',
+ 'sunday'
+];
+
+function my_plugin_menu() {
+ add_menu_page('GLM Timecard 0', 'GLM Timecard 1', 'administrator', 'my-plugin-settings', 'my_plugin_settings_page', 'dashicons-admin-generic');
+}
+
+
+function my_plugin_settings_page() {
+ global $days;
+ ?>
+
+ <div class="wrap">
+<h2>Staff Details</h2>
+
+<form method="post" action="options.php">
+ <?php settings_fields( 'my-plugin-settings-group' ); ?>
+ <?php do_settings_sections( 'my-plugin-settings-group' ); ?>
+<?php
+
+// echo "<p>Monday:".strtotime('monday this week');
+// echo "<p>sunday:".date( 'Y-m-d', strtotime('sunday last week'));
+// echo "<p>monday:".date( 'Y-m-d', strtotime('monday this week'));
+// echo "<p>tuesday:".date( 'Y-m-d', strtotime('tuesday this week'));
+// echo "<p>wednesday:".date( 'Y-m-d', strtotime('wednesday this week'));
+// echo "<p>thursday:".date( 'Y-m-d', strtotime('thursday this week'));
+// echo "<p>friday:".date( 'Y-m-d', strtotime('friday this week'));
+// echo "<p>saturday:".date( 'Y-m-d', strtotime('saturday this week'));
+// date_default_timezone_set('EST');
+// echo "EST:".time()."<br>";
+// $date = date('I','m/d/Y h:i:s a');
+// echo "<br><p>".var_dump($date, true)."</p><br>";
+//
+// $nextWeek = time() + (7 * 24 * 60 * 60);
+//
+// ini_set('date.timezone', 'EST');
+// echo "time4".date('H:i:s', time() - date('Z'));
+// echo "time5".date('H:i:s', gmdate('U'));
+// echo "time6".date('H:i:s', time());
+
+
+ // 7 days; 24 hours; 60 mins; 60 secs
+//echo 'Now: '. date('Y-m-d') ."\n";
+//echo 'Next Week: '. date('Y-m-d', $nextWeek) ."\n";
+// or using strtotime():
+//echo 'Next Week: '. date('Y-m-d', strtotime('+1 week')) ."\n";
+
+echo "<p>For week starting Monday, ". date( 'Y-m-d', strtotime("monday this week")) ." and ending Sunday, " . date( 'Y-m-d', strtotime("this sunday"))."</p>";
+
+ ?>
+ <table class="form-table" style="max-width: 600px">
+ <tr>
+ <td>Date</td>
+ <td>Day</td>
+ <td>Start</td>
+ <td>End</td>
+ <td>Lunch</td>
+ <td>Lunch Minutes</td>
+ <td>Total Minutes</td>
+ <td>Total Hours</td>
+ </tr>
+ <?php foreach($days as $day) { ?>
+
+ <tr valign="top">
+ <td><?php echo date( 'Y-m-d', strtotime($day.' this week')); ?></td>
+ <td><?php echo ucfirst($day).": "?></td>
+ <td>
+ <td id="<?php echo $day ?>_glm_timecard_time_wrap">
+ <table>
+ <tr>
+ <td>
+ <input type="text" id="<?php echo $day; ?>_bgn" class="time start glm_timecard_time_bgn glm_timecard_timepicker ui-timepicker-input" name="<?php echo $day; ?>" value="<?php echo esc_attr( get_option($day."_bgn") ); ?>" />
+ <div id="<?php echo $day; ?>_bgn_button" class="button glm_timecard_timepicker_bgn_button">Set field to current time</div>
+ </td>
+ <td>
+ <input type="text" id="<?php echo $day; ?>_end" class="time end glm_timecard_time_end glm_timecard_timepicker ui-timepicker-input" name="<?php echo $day; ?>" value="<?php echo esc_attr( get_option($day."_end") ); ?>" />
+ <div id="<?php echo $day; ?>_end_button" class="button glm_timecard_timepicker_end_button">Set field to current time</div>
+ </td>
+ </tr>
+ </table>
+
+ </td>
+ <td><input type="checkbox" id="<?php echo $day; ?>_lunch" class="glm_timecard_lunch_checkbox" name="<?php echo $day; ?>_lunch" selected="false"></td>
+ <td><input type="number" id="<?php echo $day; ?>_lunch_minutes" class="glm_timecard_lunch_minutes" name="<?php echo $day; ?>_lunch_minutes" value="30" disabled/></td>
+ <td><label id="<?php echo $day; ?>_total_minutes" class="glm_timecard_total_minutes"name=" <?php echo $day; ?>_total_minutes" value="0"></label></td>
+ <td><label id="<?php echo $day; ?>_total_hours" class="glm_timecard_total_hours"name=" <?php echo $day; ?>_total_hours" value="0"></label></td>
+ </tr>
+ <?php } ?>
+
+ </table>
+
+ <?php submit_button(); ?>
+
+</form>
+</div>
+<?php
+}
+
+add_action( 'admin_init', 'my_plugin_settings' );
+
+function my_plugin_settings() {
+ global $days;
+ foreach($days as $day) {
+ register_setting( 'my-plugin-settings-group', $day.'_bgn' );
+ register_setting( 'my-plugin-settings-group', $day.'_end' );
+ }
+}
+?>
+<script>
+$(document).ready(function() {
+
+//$('.glm_timecard_timepicker').datepair({
+// parseDate: function (el) {
+// var utc = new Date($(el).datepicker('getDate'));
+// return utc && new Date(utc.getTime() + (utc.getTimezoneOffset() * 60000));
+// },
+// updateDate: function (el, v) {
+// $(el).datepicker('setDate', new Date(v.getTime() - (v.getTimezoneOffset() * 60000)));
+// }
+//});
+ $('.glm_timecard_timepicker').timepicker({
+
+ 'showDuration' : true,
+ 'timeFormat': 'g:ia',
+ 'forceRoundTime': true
+ });
+
+
+ var timePairMonday = document.getElementById('monday_glm_timecard_time_wrap');
+ var timePairTuesday = document.getElementById('tuesday_glm_timecard_time_wrap');
+ var timePairWednesday = document.getElementById('wednesday_glm_timecard_time_wrap');
+ var timePairThursday = document.getElementById('thursday_glm_timecard_time_wrap');
+ var timePairFriday = document.getElementById('friday_glm_timecard_time_wrap');
+ var timePairSaturday = document.getElementById('saturday_glm_timecard_time_wrap');
+ var timePairSunday = document.getElementById('sunday_glm_timecard_time_wrap');
+
+
+
+ var datepairTuesday = new Datepair(timePairTuesday);
+ var datepairWednesday = new Datepair(timePairWednesday);
+ var datepairThursday = new Datepair(timePairThursday);
+ var datepairFriday = new Datepair(timePairFriday);
+ var datepairSaturday = new Datepair(timePairSaturday);
+ var datepairSunday = new Datepair(timePairSunday);
+
+ $('.glm_timecard_timepicker_bgn_button').on('click', function (){
+ var target = $(this).attr("id").slice(0, -13);
+ $('#'+target+"_bgn").timepicker('setTime', new Date());
+ });
+
+ $('.glm_timecard_timepicker_end_button').on('click', function (){
+ var target = $(this).attr("id").slice(0, -11);
+ $('#'+target+"_end").timepicker('setTime', new Date());
+ });
+
+ $('.glm_timecard_timepicker').on('changeTime', function() {
+// console.log($(this).val());
+ var target = $(this).attr("id").slice(0, -4);
+
+ switch(target) {
+ case 'monday':
+ var datepairUpdated = new Datepair(timePairMonday);
+ break;
+ case 'tuesday':
+ var datepairUpdated = datepairTuesday;
+ break;
+ case 'wednesday':
+ var datepairUpdated = datepairWednesday;
+ break;
+ case 'thursday':
+ var datepairUpdated = datepairThursday;
+ break;
+ case 'friday':
+ var datepairUpdated = datepairFriday;
+ break;
+ case 'saturday':
+ var datepairUpdated = datepairSaturday;
+ break;
+ case 'sunday':
+ var datepairUpdated = datepairSunday;
+ break;
+ }
+ datepairUpdated.refresh();
+ var timeDifference = datepairUpdated.getTimeDiff();
+ console.log(timeDifference);
+ var timeDifferenceSeconds = (timeDifference / 1000);
+ console.log(timeDifferenceSeconds);
+ console.log($(target+"_lunch_minutes").val());
+ var timeDifferenceMinutes = (timeDifferenceSeconds / 60) - parseInt($(target+"_lunch_minutes").attr('value'));
+ console.log(timeDifferenceMinutes);
+ var timeDifferenceHours = timeDifferenceMinutes / 60;
+ console.log(timeDifferenceHours);
+ $("#"+target+"_total_minutes").text(timeDifferenceMinutes);
+ $("#"+target+"_total_hours").text(timeDifferenceHours);
+
+
+
+
+ if ($('.glm_timecard_time_end').val()) {
+
+// var bgn_time = $("#"+target+"_bgn").val();
+// var end_time = $("#"+target+"_end").val();
+// console.log(bgn_time+end_time);
+// $("#"+target+"_total_minutes").text(bgn_time + end_time);
+ }
+
+
+ });
+
+ $('.glm_timecard_lunch_checkbox').change(function () {
+ var target = $(this).attr("id").slice(0, -6);
+ if (this.checked) {
+ $("#"+target+"_lunch_minutes").attr('disabled',false);
+ } else {
+ $("#"+target+"_lunch_minutes").attr('disabled',true);
+ }
+ });
+});
+
+</script>
\ No newline at end of file
--- /dev/null
+module.exports = function(grunt) {
+ grunt.initConfig({
+ pkg: grunt.file.readJSON('package.json'),
+ meta: {
+ banner: '/*!\n' +
+ ' * <%= pkg.name %> v<%= pkg.version %> - <%= pkg.description %>\n' +
+ ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> - <%= pkg.homepage %>\n' +
+ ' * License: <%= pkg.license %>\n' +
+ ' */\n\n'
+ },
+
+ rig: {
+ options: {
+ banner: '<%= meta.banner %>'
+ },
+ dist: {
+ files: {
+ 'dist/datepair.js': ['src/wrapper.js'],
+ 'dist/jquery.datepair.js' : ['src/jquery.datepair.js'],
+ }
+ }
+ },
+
+ uglify: {
+ options: {
+ banner: '<%= meta.banner %>',
+ report: 'gzip'
+ },
+ dist: {
+ files: {
+ 'dist/datepair.min.js': 'dist/datepair.js',
+ 'dist/jquery.datepair.min.js': ['dist/datepair.js', 'dist/jquery.datepair.js'],
+ }
+ }
+ },
+ jshint: {
+ all: ['src/*.js']
+ },
+
+ watch: {
+ options : {
+ atBegin : true
+ },
+ files: ['src/*.js'],
+ tasks: ['rig']
+ }
+ });
+
+ grunt.loadNpmTasks('grunt-contrib-uglify');
+ grunt.loadNpmTasks('grunt-rigger');
+ grunt.loadNpmTasks('grunt-contrib-watch');
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+
+ grunt.registerTask('default', ['rig', 'uglify']);
+};
--- /dev/null
+# Datepair.js
+
+[See a demo and examples here](http://jonthornton.github.com/Datepair.js)
+
+Datepair.js is a lightweight, modular javascript plugin for intelligently selecting date and time ranges, inspired by Google Calendar. It will keep the start and end date/times in sync and can set default values based on user action. There are no external dependencies, however it can easily be used with jQuery or Zepto. The plugin does not provide any UI widgets; it's preconfigured to work with [jquery-timepicker](https://github.com/jonthornton/jquery-timepicker) and [Bootstrap Datepicker](https://github.com/eternicode/bootstrap-datepicker), but you can use it with any datepicker or timepicker (or none at all).
+
+*Looking for [jquery-datepair](#jquery-plugin)? Scroll down.*
+
+## Requirements
+
+* [jquery-timepicker](https://github.com/jonthornton/jquery-timepicker) (>= 1.3) (this dependency can be overridden)
+* [Bootstrap Datepicker](https://github.com/eternicode/bootstrap-datepicker) (>= 1.3) (this dependency can be overridden)
+
+## Usage
+
+Include `dist/datepair.js` or `dist/jquery.datepair.min.js` in your app.
+
+```javascript
+var container = document.getElementById('container')
+var datepair = new Datepair(container, options);
+```
+
+Where ```#container``` contains time/date input elements with the appropriate class names. ```options``` is an optional javascript object with parameters explained below.
+
+You can also install via [Bower](http://bower.io/) with `bower install datepair.js`.
+
+## Options
+
+- **anchor**
+The input that will control the other input. One of `"start"`, `"end"`, or `null`. See [demo page](http://jonthornton.github.io/Datepair.js/) for more information.
+*default: "start"*
+
+- **dateClass**
+Class name of the date inputs, if any.
+*default: "date"*
+
+- **defaultDateDelta**
+Fill in the second date value with the specified range when the users selects the first date. Value is in days. Set this to ```null``` to disable automatically setting the second date.
+*default: 0*
+
+- **defaultTimeDelta**
+Fill in the second time value with the specified range when the users selects the first time. Value is in milliseconds; set this to ```7200000``` for a 2 hour range, for example. Set this to ```null``` to disable automatically setting the second time.
+*default: 0*
+
+- **endClass**
+Class name of the range end input(s).
+*default: "end"*
+
+- **parseDate**
+A function that takes a jQuery element for a date input and returns a local time ```Date``` object representing the date input value.
+*default: function for [Bootstrap Datepicker](https://github.com/eternicode/bootstrap-datepicker)*
+
+- **parseTime**
+A function that takes a jQuery element for a time input and returns a local time ```Date``` object representing the time input value. See [example page](http://jonthornton.github.com/Datepair.js) for more info.
+*default: function for [jquery-timepicker](https://github.com/jonthornton/jquery-timepicker)*
+
+- **setMinTime**
+A function that takes a jQuery element for a time input and a local time ```Date``` object representing the time, and sets the timepicker minTime value.
+*default: function for [jquery-timepicker](https://github.com/jonthornton/jquery-timepicker)*
+
+- **startClass**
+Class name of the range start input(s).
+*default: "start"*
+
+- **timeClass**
+Class name of the time inputs, if any.
+*default: "time"*
+
+- **updateDate**
+A function that takes a jQuery element for a date input and a local time ```Date``` object representing the date, and sets the input value.
+*default: function for [Bootstrap Datepicker](https://github.com/eternicode/bootstrap-datepicker)*
+
+- **updateTime**
+A function that takes a jQuery element for a time input and a local time ```Date``` object representing the time, and sets the input value.
+*default: function for [jquery-timepicker](https://github.com/jonthornton/jquery-timepicker)*
+
+
+## Methods
+
+- **getTimeDiff**
+Get the date/time range size, in milliseconds.
+
+ ```javascript
+ var milliseconds = datepair.getTimeDiff();
+ ```
+
+- **refresh**
+Call this method if you programmatically update the date/time fields after first initialization of datepair.
+
+ ```javascript
+ $('#someInput').val(someValue)
+ datepair.refresh();
+ ```
+
+- **remove**
+Unbind the datepair functionality from a set of inputs.
+
+ ```javascript
+ datepair.remove();
+ ```
+
+## Events
+
+- **rangeError**
+Fired after the user interacts with the datepair inputs but selects an invalid range, where the end time/date is before the start.
+
+- **rangeIncomplete**
+Fired after the user interacts with the datepair inputs but one or more empty inputs remain. Unpaired inputs (such as a start date with no corresponding end date) will not be taken into account.
+
+- **rangeSelected**
+Fired after the user interacts with the datepair inputs and all paired inputs have valid values.
+
+## jQuery Plugin
+
+Datepair.js includes an optional jQuery interface that can simplify usage when working with jQuery or Zepto. To activate, include both `datepair.js` and `jquery.datepair.js`, or just `jquery.datepair.min.js`. (The minified version includes both scripts.)
+
+### Usage
+
+```javascript
+$('#container').datepair(options);
+var milliseconds = $('#container').datepair('getTimeDiff');
+$('#container').datepair('remove');
+$('#container').datepair('refresh');
+```
+
+## jQuery-UI Datepicker
+
+By default, Datepair.js is configured to work with [Bootstrap Datepicker](https://github.com/eternicode/bootstrap-datepicker). This is different from [jQuery UI Datepicker](http://jqueryui.com/datepicker/). To use jQuery UI Datepicker, override the `parseDate` and `updateDate` methods:
+
+```javascript
+$('#some-container').datepair({
+ parseDate: function (el) {
+ var utc = new Date($(el).datepicker('getDate'));
+ return utc && new Date(utc.getTime() + (utc.getTimezoneOffset() * 60000));
+ },
+ updateDate: function (el, v) {
+ $(el).datepicker('setDate', new Date(v.getTime() - (v.getTimezoneOffset() * 60000)));
+ }
+});
+```
+
+## Help
+
+Submit a [GitHub Issues request](https://github.com/jonthornton/Datepair.js/issues/new).
+
+## Development Guidelines
+
+* Install dependencies (grunt) `npm install`
+* To build and minify, run `grunt`
+* Use `grunt watch` to continuously build while developing
+
+Datepair.js follows [semantic versioning](http://semver.org/).
+
+- - -
+
+This software is made available under the open source MIT License. © 2014 [Jon Thornton](http://www.jonthornton.com).
--- /dev/null
+{
+ "name": "datepair.js",
+ "version": "0.4.14",
+ "main": ["dist/datepair.js", "dist/jquery.datepair.js"],
+ "ignore": [
+ "**/.*",
+ "node_modules",
+ "components",
+ "spec",
+ "Gruntfile.js",
+ "src",
+ "bower_components",
+ "test",
+ "tests"
+ ],
+ "homepage": "http://jonthornton.github.com/Datepair.js",
+ "authors": [
+ "Jon Thornton"
+ ],
+ "description": "A javascript plugin for intelligently selecting date and time ranges inspired by Google Calendar.",
+ "keywords": [ "timepicker", "datepicker", "time", "date", "picker", "ui", "calendar", "input", "form" ],
+ "license": "MIT"
+}
--- /dev/null
+{
+ "name": "datepair",
+ "version": "0.4.10",
+ "title": "Datepair.js",
+ "description": "A plugin for intelligently selecting date and time ranges inspired by Google Calendar.",
+ "author": {
+ "name": "Jon Thornton",
+ "email": "thornton.jon@gmail.com",
+ "url": "https://github.com/jonthornton"
+ },
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "http://opensource.org/licenses/MIT"
+ }
+ ],
+ "dependencies": {
+ "jquery": ">=1.7"
+ },
+ "keywords": [ "timepicker", "datepicker", "time", "date", "picker", "ui", "calendar", "input", "form" ],
+ "homepage": "http://jonthornton.github.com/jquery-datepair/",
+ "bugs": {
+ "url": "https://github.com/jonthornton/jquery-datepair/issues"
+ },
+ "docs": "https://github.com/jonthornton/jquery-datepair",
+ "download": "https://github.com/jonthornton/jquery-datepair"
+}
--- /dev/null
+/*!
+ * datepair.js v0.4.14 - A javascript plugin for intelligently selecting date and time ranges inspired by Google Calendar.
+ * Copyright (c) 2015 Jon Thornton - http://jonthornton.github.com/Datepair.js
+ * License: MIT
+ */
+
+(function(window, document) {
+
+ 'use strict';
+
+ var _ONE_DAY = 86400000;
+ var jq = window.Zepto || window.jQuery;
+
+ function simpleExtend(obj1, obj2) {
+ var out = obj2 || {};
+
+ for (var i in obj1) {
+ if (!(i in out)) {
+ out[i] = obj1[i];
+ }
+ }
+
+ return out;
+ }
+
+ // IE's custom event support is totally borked.
+ // Use jQuery if possible
+ function triggerSimpleCustomEvent(el, eventName) {
+ if (jq) {
+ jq(el).trigger(eventName);
+ } else {
+ var event = document.createEvent('CustomEvent');
+ event.initCustomEvent(eventName, true, true, {});
+ el.dispatchEvent(event);
+ }
+ }
+
+ // el.classList not supported by < IE10
+ // use jQuery if available
+ function hasClass(el, className) {
+ if (jq) {
+ return jq(el).hasClass(className);
+ } else {
+ return el.classList.contains(className);
+ }
+ }
+
+ function Datepair(container, options) {
+ this.dateDelta = null;
+ this.timeDelta = null;
+ this._defaults = {
+ startClass: 'start',
+ endClass: 'end',
+ timeClass: 'time',
+ dateClass: 'date',
+ defaultDateDelta: 0,
+ defaultTimeDelta: 3600000,
+ anchor: 'start',
+
+ // defaults for jquery-timepicker; override when using other input widgets
+ parseTime: function(input){
+ return jq(input).timepicker('getTime');
+ },
+ updateTime: function(input, dateObj){
+ jq(input).timepicker('setTime', dateObj);
+ },
+ setMinTime: function(input, dateObj){
+ jq(input).timepicker('option', 'minTime', dateObj);
+ },
+
+ // defaults for bootstrap datepicker; override when using other input widgets
+ parseDate: function(input){
+ return input.value && jq(input).datepicker('getDate');
+ },
+ updateDate: function(input, dateObj){
+ jq(input).datepicker('update', dateObj);
+ }
+ };
+
+ this.container = container;
+ this.settings = simpleExtend(this._defaults, options);
+
+ this.startDateInput = this.container.querySelector('.'+this.settings.startClass+'.'+this.settings.dateClass);
+ this.endDateInput = this.container.querySelector('.'+this.settings.endClass+'.'+this.settings.dateClass);
+ this.startTimeInput = this.container.querySelector('.'+this.settings.startClass+'.'+this.settings.timeClass);
+ this.endTimeInput = this.container.querySelector('.'+this.settings.endClass+'.'+this.settings.timeClass);
+
+ // initialize date and time deltas
+ this.refresh();
+
+ // init starts here
+ this._bindChangeHandler();
+ }
+
+ Datepair.prototype = {
+ constructor: Datepair,
+
+ option: function(key, value)
+ {
+ if (typeof key == 'object') {
+ this.settings = simpleExtend(this.settings, key);
+
+ } else if (typeof key == 'string' && typeof value != 'undefined') {
+ this.settings[key] = value;
+
+ } else if (typeof key == 'string') {
+ return this.settings[key];
+ }
+
+ this._updateEndMintime();
+ },
+
+ getTimeDiff: function()
+ {
+ // due to the fact that times can wrap around, timeDiff for any
+ // time-only pair will always be >= 0
+ var delta = this.dateDelta + this.timeDelta;
+ if (delta < 0 && (!this.startDateInput || !this.endDateInput) ) {
+ delta += _ONE_DAY;
+ }
+
+ return delta;
+ },
+
+ refresh: function()
+ {
+ if (this.startDateInput && this.startDateInput.value && this.endDateInput && this.endDateInput.value) {
+ var startDate = this.settings.parseDate(this.startDateInput);
+ var endDate = this.settings.parseDate(this.endDateInput);
+ if (startDate && endDate) {
+ this.dateDelta = endDate.getTime() - startDate.getTime();
+ }
+ }
+ if (this.startTimeInput && this.startTimeInput.value && this.endTimeInput && this.endTimeInput.value) {
+ var startTime = this.settings.parseTime(this.startTimeInput);
+ var endTime = this.settings.parseTime(this.endTimeInput);
+ if (startTime && endTime) {
+ this.timeDelta = endTime.getTime() - startTime.getTime();
+ this._updateEndMintime();
+ }
+ }
+ },
+
+ remove: function()
+ {
+ this._unbindChangeHandler();
+ },
+
+ _bindChangeHandler: function(){
+ // addEventListener doesn't work with synthetic "change" events
+ // fired by jQuery's trigger() functioin. If jQuery is present,
+ // use that for event binding
+ if (jq) {
+ jq(this.container).on('change.datepair', jq.proxy(this.handleEvent, this));
+ } else {
+ this.container.addEventListener('change', this, false);
+ }
+ },
+
+ _unbindChangeHandler: function(){
+ if (jq) {
+ jq(this.container).off('change.datepair');
+ } else {
+ this.container.removeEventListener('change', this, false);
+ }
+ },
+
+ // This function will be called when passing 'this' to addEventListener
+ handleEvent: function(e){
+ // temporarily unbind the change handler to prevent triggering this
+ // if we update other inputs
+ this._unbindChangeHandler();
+
+ if (hasClass(e.target, this.settings.dateClass)) {
+ if (e.target.value != '') {
+ this._dateChanged(e.target);
+ this._timeChanged(e.target);
+ } else {
+ this.dateDelta = null;
+ }
+
+ } else if (hasClass(e.target, this.settings.timeClass)) {
+ if (e.target.value != '') {
+ this._timeChanged(e.target);
+ } else {
+ this.timeDelta = null;
+ }
+ }
+
+ this._validateRanges();
+ this._updateEndMintime();
+ this._bindChangeHandler();
+ },
+
+ _dateChanged: function(target){
+ if (!this.startDateInput || !this.endDateInput) {
+ return;
+ }
+
+ var startDate = this.settings.parseDate(this.startDateInput);
+ var endDate = this.settings.parseDate(this.endDateInput);
+
+ if (!startDate || !endDate) {
+ if (this.settings.defaultDateDelta !== null) {
+ if (startDate) {
+ var newEnd = new Date(startDate.getTime() + this.settings.defaultDateDelta * _ONE_DAY);
+ this.settings.updateDate(this.endDateInput, newEnd);
+
+ } else if (endDate) {
+ var newStart = new Date(endDate.getTime() - this.settings.defaultDateDelta * _ONE_DAY);
+ this.settings.updateDate(this.startDateInput, newStart);
+ }
+
+ this.dateDelta = this.settings.defaultDateDelta * _ONE_DAY;
+ } else {
+ this.dateDelta = null;
+ }
+
+ return;
+ }
+
+ if (this.settings.anchor == 'start' && hasClass(target, this.settings.startClass)) {
+ var newDate = new Date(startDate.getTime() + this.dateDelta);
+ this.settings.updateDate(this.endDateInput, newDate);
+ } else if (this.settings.anchor == 'end' && hasClass(target, this.settings.endClass)) {
+ var newDate = new Date(endDate.getTime() - this.dateDelta);
+ this.settings.updateDate(this.startDateInput, newDate);
+ } else {
+ if (endDate < startDate) {
+ var otherInput = hasClass(target, this.settings.startClass) ? this.endDateInput : this.startDateInput;
+ var selectedDate = this.settings.parseDate(target);
+ this.dateDelta = 0;
+ this.settings.updateDate(otherInput, selectedDate);
+ } else {
+ this.dateDelta = endDate.getTime() - startDate.getTime();
+ }
+ }
+ },
+
+ _timeChanged: function(target){
+ if (!this.startTimeInput || !this.endTimeInput) {
+ return;
+ }
+
+ var startTime = this.settings.parseTime(this.startTimeInput);
+ var endTime = this.settings.parseTime(this.endTimeInput);
+
+ if (!startTime || !endTime) {
+ if (this.settings.defaultTimeDelta !== null) {
+ if (startTime) {
+ var newEnd = new Date(startTime.getTime() + this.settings.defaultTimeDelta);
+ this.settings.updateTime(this.endTimeInput, newEnd);
+ } else if (endTime) {
+ var newStart = new Date(endTime.getTime() - this.settings.defaultTimeDelta);
+ this.settings.updateTime(this.startTimeInput, newStart);
+ }
+
+ this.timeDelta = this.settings.defaultTimeDelta;
+ } else {
+ this.timeDelta = null;
+ }
+
+ return;
+ }
+
+ if (this.settings.anchor == 'start' && hasClass(target, this.settings.startClass)) {
+ var newTime = new Date(startTime.getTime() + this.timeDelta);
+ this.settings.updateTime(this.endTimeInput, newTime);
+ endTime = this.settings.parseTime(this.endTimeInput);
+
+ this._doMidnightRollover(startTime, endTime);
+ } else if (this.settings.anchor == 'end' && hasClass(target, this.settings.endClass)) {
+ var newTime = new Date(endTime.getTime() - this.timeDelta);
+ this.settings.updateTime(this.startTimeInput, newTime);
+ startTime = this.settings.parseTime(this.startTimeInput);
+
+ this._doMidnightRollover(startTime, endTime);
+ } else {
+ this._doMidnightRollover(startTime, endTime);
+
+ var startDate, endDate;
+ if (this.startDateInput && this.endDateInput) {
+ startDate = this.settings.parseDate(this.startDateInput);
+ endDate = this.settings.parseDate(this.endDateInput);
+ }
+
+ if ((+startDate == +endDate) && (endTime < startTime)) {
+ var thisInput = hasClass(target, this.settings.endClass) ? this.endTimeInput : this.startTimeInput;
+ var otherInput = hasClass(target, this.settings.startClass) ? this.endTimeInput : this.startTimeInput;
+ var selectedTime = this.settings.parseTime(thisInput);
+ this.timeDelta = 0;
+ this.settings.updateTime(otherInput, selectedTime);
+ } else {
+ this.timeDelta = endTime.getTime() - startTime.getTime();
+ }
+ }
+
+
+ },
+
+ _doMidnightRollover: function(startTime, endTime) {
+ if (!this.startDateInput || !this.endDateInput) {
+ return;
+ }
+
+ var endDate = this.settings.parseDate(this.endDateInput);
+ var startDate = this.settings.parseDate(this.startDateInput);
+ var newDelta = endTime.getTime() - startTime.getTime();
+ var offset = (endTime < startTime) ? _ONE_DAY : -1 * _ONE_DAY;
+
+ if (this.dateDelta !== null
+ && this.dateDelta + this.timeDelta <= _ONE_DAY
+ && this.dateDelta + newDelta != 0
+ && (offset > 0 || this.dateDelta != 0)
+ && ((newDelta >= 0 && this.timeDelta < 0) || (newDelta < 0 && this.timeDelta >= 0))) {
+
+ if (this.settings.anchor == 'start') {
+ this.settings.updateDate(this.endDateInput, new Date(endDate.getTime() + offset));
+ this._dateChanged(this.endDateInput);
+ } else if (this.settings.anchor == 'end') {
+ this.settings.updateDate(this.startDateInput, new Date(startDate.getTime() - offset));
+ this._dateChanged(this.startDateInput);
+ }
+ }
+ this.timeDelta = newDelta;
+ },
+
+ _updateEndMintime: function(){
+ if (typeof this.settings.setMinTime != 'function') return;
+
+ var baseTime = null;
+ if (this.settings.anchor == 'start' && (!this.dateDelta || this.dateDelta < _ONE_DAY || (this.timeDelta && this.dateDelta + this.timeDelta < _ONE_DAY))) {
+ baseTime = this.settings.parseTime(this.startTimeInput);
+ }
+
+ this.settings.setMinTime(this.endTimeInput, baseTime);
+ },
+
+ _validateRanges: function(){
+ if (this.startTimeInput && this.endTimeInput && this.timeDelta === null) {
+ triggerSimpleCustomEvent(this.container, 'rangeIncomplete');
+ return;
+ }
+
+ if (this.startDateInput && this.endDateInput && this.dateDelta === null) {
+ triggerSimpleCustomEvent(this.container, 'rangeIncomplete');
+ return;
+ }
+
+ // due to the fact that times can wrap around, any time-only pair will be considered valid
+ if (!this.startDateInput || !this.endDateInput || this.dateDelta + this.timeDelta >= 0) {
+ triggerSimpleCustomEvent(this.container, 'rangeSelected');
+ } else {
+ triggerSimpleCustomEvent(this.container, 'rangeError');
+ }
+ }
+ };
+
+ window.Datepair = Datepair;
+
+}(window, document));
\ No newline at end of file
--- /dev/null
+/*!
+ * datepair.js v0.4.14 - A javascript plugin for intelligently selecting date and time ranges inspired by Google Calendar.
+ * Copyright (c) 2015 Jon Thornton - http://jonthornton.github.com/Datepair.js
+ * License: MIT
+ */
+
+!function(a,b){"use strict";function c(a,b){var c=b||{};for(var d in a)d in c||(c[d]=a[d]);return c}function d(a,c){if(h)h(a).trigger(c);else{var d=b.createEvent("CustomEvent");d.initCustomEvent(c,!0,!0,{}),a.dispatchEvent(d)}}function e(a,b){return h?h(a).hasClass(b):a.classList.contains(b)}function f(a,b){this.dateDelta=null,this.timeDelta=null,this._defaults={startClass:"start",endClass:"end",timeClass:"time",dateClass:"date",defaultDateDelta:0,defaultTimeDelta:36e5,anchor:"start",parseTime:function(a){return h(a).timepicker("getTime")},updateTime:function(a,b){h(a).timepicker("setTime",b)},setMinTime:function(a,b){h(a).timepicker("option","minTime",b)},parseDate:function(a){return a.value&&h(a).datepicker("getDate")},updateDate:function(a,b){h(a).datepicker("update",b)}},this.container=a,this.settings=c(this._defaults,b),this.startDateInput=this.container.querySelector("."+this.settings.startClass+"."+this.settings.dateClass),this.endDateInput=this.container.querySelector("."+this.settings.endClass+"."+this.settings.dateClass),this.startTimeInput=this.container.querySelector("."+this.settings.startClass+"."+this.settings.timeClass),this.endTimeInput=this.container.querySelector("."+this.settings.endClass+"."+this.settings.timeClass),this.refresh(),this._bindChangeHandler()}var g=864e5,h=a.Zepto||a.jQuery;f.prototype={constructor:f,option:function(a,b){if("object"==typeof a)this.settings=c(this.settings,a);else if("string"==typeof a&&"undefined"!=typeof b)this.settings[a]=b;else if("string"==typeof a)return this.settings[a];this._updateEndMintime()},getTimeDiff:function(){var a=this.dateDelta+this.timeDelta;return!(0>a)||this.startDateInput&&this.endDateInput||(a+=g),a},refresh:function(){if(this.startDateInput&&this.startDateInput.value&&this.endDateInput&&this.endDateInput.value){var a=this.settings.parseDate(this.startDateInput),b=this.settings.parseDate(this.endDateInput);a&&b&&(this.dateDelta=b.getTime()-a.getTime())}if(this.startTimeInput&&this.startTimeInput.value&&this.endTimeInput&&this.endTimeInput.value){var c=this.settings.parseTime(this.startTimeInput),d=this.settings.parseTime(this.endTimeInput);c&&d&&(this.timeDelta=d.getTime()-c.getTime(),this._updateEndMintime())}},remove:function(){this._unbindChangeHandler()},_bindChangeHandler:function(){h?h(this.container).on("change.datepair",h.proxy(this.handleEvent,this)):this.container.addEventListener("change",this,!1)},_unbindChangeHandler:function(){h?h(this.container).off("change.datepair"):this.container.removeEventListener("change",this,!1)},handleEvent:function(a){this._unbindChangeHandler(),e(a.target,this.settings.dateClass)?""!=a.target.value?(this._dateChanged(a.target),this._timeChanged(a.target)):this.dateDelta=null:e(a.target,this.settings.timeClass)&&(""!=a.target.value?this._timeChanged(a.target):this.timeDelta=null),this._validateRanges(),this._updateEndMintime(),this._bindChangeHandler()},_dateChanged:function(a){if(this.startDateInput&&this.endDateInput){var b=this.settings.parseDate(this.startDateInput),c=this.settings.parseDate(this.endDateInput);if(b&&c)if("start"==this.settings.anchor&&e(a,this.settings.startClass)){var d=new Date(b.getTime()+this.dateDelta);this.settings.updateDate(this.endDateInput,d)}else if("end"==this.settings.anchor&&e(a,this.settings.endClass)){var d=new Date(c.getTime()-this.dateDelta);this.settings.updateDate(this.startDateInput,d)}else if(b>c){var f=e(a,this.settings.startClass)?this.endDateInput:this.startDateInput,h=this.settings.parseDate(a);this.dateDelta=0,this.settings.updateDate(f,h)}else this.dateDelta=c.getTime()-b.getTime();else if(null!==this.settings.defaultDateDelta){if(b){var i=new Date(b.getTime()+this.settings.defaultDateDelta*g);this.settings.updateDate(this.endDateInput,i)}else if(c){var j=new Date(c.getTime()-this.settings.defaultDateDelta*g);this.settings.updateDate(this.startDateInput,j)}this.dateDelta=this.settings.defaultDateDelta*g}else this.dateDelta=null}},_timeChanged:function(a){if(this.startTimeInput&&this.endTimeInput){var b=this.settings.parseTime(this.startTimeInput),c=this.settings.parseTime(this.endTimeInput);if(b&&c)if("start"==this.settings.anchor&&e(a,this.settings.startClass)){var d=new Date(b.getTime()+this.timeDelta);this.settings.updateTime(this.endTimeInput,d),c=this.settings.parseTime(this.endTimeInput),this._doMidnightRollover(b,c)}else if("end"==this.settings.anchor&&e(a,this.settings.endClass)){var d=new Date(c.getTime()-this.timeDelta);this.settings.updateTime(this.startTimeInput,d),b=this.settings.parseTime(this.startTimeInput),this._doMidnightRollover(b,c)}else{this._doMidnightRollover(b,c);var f,g;if(this.startDateInput&&this.endDateInput&&(f=this.settings.parseDate(this.startDateInput),g=this.settings.parseDate(this.endDateInput)),+f==+g&&b>c){var h=e(a,this.settings.endClass)?this.endTimeInput:this.startTimeInput,i=e(a,this.settings.startClass)?this.endTimeInput:this.startTimeInput,j=this.settings.parseTime(h);this.timeDelta=0,this.settings.updateTime(i,j)}else this.timeDelta=c.getTime()-b.getTime()}else if(null!==this.settings.defaultTimeDelta){if(b){var k=new Date(b.getTime()+this.settings.defaultTimeDelta);this.settings.updateTime(this.endTimeInput,k)}else if(c){var l=new Date(c.getTime()-this.settings.defaultTimeDelta);this.settings.updateTime(this.startTimeInput,l)}this.timeDelta=this.settings.defaultTimeDelta}else this.timeDelta=null}},_doMidnightRollover:function(a,b){if(this.startDateInput&&this.endDateInput){var c=this.settings.parseDate(this.endDateInput),d=this.settings.parseDate(this.startDateInput),e=b.getTime()-a.getTime(),f=a>b?g:-1*g;null!==this.dateDelta&&this.dateDelta+this.timeDelta<=g&&this.dateDelta+e!=0&&(f>0||0!=this.dateDelta)&&(e>=0&&this.timeDelta<0||0>e&&this.timeDelta>=0)&&("start"==this.settings.anchor?(this.settings.updateDate(this.endDateInput,new Date(c.getTime()+f)),this._dateChanged(this.endDateInput)):"end"==this.settings.anchor&&(this.settings.updateDate(this.startDateInput,new Date(d.getTime()-f)),this._dateChanged(this.startDateInput))),this.timeDelta=e}},_updateEndMintime:function(){if("function"==typeof this.settings.setMinTime){var a=null;"start"==this.settings.anchor&&(!this.dateDelta||this.dateDelta<g||this.timeDelta&&this.dateDelta+this.timeDelta<g)&&(a=this.settings.parseTime(this.startTimeInput)),this.settings.setMinTime(this.endTimeInput,a)}},_validateRanges:function(){return this.startTimeInput&&this.endTimeInput&&null===this.timeDelta?void d(this.container,"rangeIncomplete"):this.startDateInput&&this.endDateInput&&null===this.dateDelta?void d(this.container,"rangeIncomplete"):void(!this.startDateInput||!this.endDateInput||this.dateDelta+this.timeDelta>=0?d(this.container,"rangeSelected"):d(this.container,"rangeError"))}},a.Datepair=f}(window,document);
\ No newline at end of file
--- /dev/null
+/*!
+ * datepair.js v0.4.14 - A javascript plugin for intelligently selecting date and time ranges inspired by Google Calendar.
+ * Copyright (c) 2015 Jon Thornton - http://jonthornton.github.com/Datepair.js
+ * License: MIT
+ */
+
+(function($) {
+
+ if(!$) {
+ return;
+ }
+
+ ////////////
+ // Plugin //
+ ////////////
+
+ $.fn.datepair = function(option) {
+ var out;
+ this.each(function() {
+ var $this = $(this);
+ var data = $this.data('datepair');
+ var options = typeof option === 'object' && option;
+
+ if (!data) {
+ data = new Datepair(this, options);
+ $this.data('datepair', data);
+ }
+
+ if (typeof option === 'string') {
+ out = data[option]();
+ }
+ });
+
+ return out || this;
+ };
+
+ //////////////
+ // Data API //
+ //////////////
+
+ $('[data-datepair]').each(function() {
+ var $this = $(this);
+ $this.datepair($this.data());
+ });
+
+}(window.Zepto || window.jQuery));
\ No newline at end of file
--- /dev/null
+/*!
+ * datepair.js v0.4.14 - A javascript plugin for intelligently selecting date and time ranges inspired by Google Calendar.
+ * Copyright (c) 2015 Jon Thornton - http://jonthornton.github.com/Datepair.js
+ * License: MIT
+ */
+
+!function(a,b){"use strict";function c(a,b){var c=b||{};for(var d in a)d in c||(c[d]=a[d]);return c}function d(a,c){if(h)h(a).trigger(c);else{var d=b.createEvent("CustomEvent");d.initCustomEvent(c,!0,!0,{}),a.dispatchEvent(d)}}function e(a,b){return h?h(a).hasClass(b):a.classList.contains(b)}function f(a,b){this.dateDelta=null,this.timeDelta=null,this._defaults={startClass:"start",endClass:"end",timeClass:"time",dateClass:"date",defaultDateDelta:0,defaultTimeDelta:36e5,anchor:"start",parseTime:function(a){return h(a).timepicker("getTime")},updateTime:function(a,b){h(a).timepicker("setTime",b)},setMinTime:function(a,b){h(a).timepicker("option","minTime",b)},parseDate:function(a){return a.value&&h(a).datepicker("getDate")},updateDate:function(a,b){h(a).datepicker("update",b)}},this.container=a,this.settings=c(this._defaults,b),this.startDateInput=this.container.querySelector("."+this.settings.startClass+"."+this.settings.dateClass),this.endDateInput=this.container.querySelector("."+this.settings.endClass+"."+this.settings.dateClass),this.startTimeInput=this.container.querySelector("."+this.settings.startClass+"."+this.settings.timeClass),this.endTimeInput=this.container.querySelector("."+this.settings.endClass+"."+this.settings.timeClass),this.refresh(),this._bindChangeHandler()}var g=864e5,h=a.Zepto||a.jQuery;f.prototype={constructor:f,option:function(a,b){if("object"==typeof a)this.settings=c(this.settings,a);else if("string"==typeof a&&"undefined"!=typeof b)this.settings[a]=b;else if("string"==typeof a)return this.settings[a];this._updateEndMintime()},getTimeDiff:function(){var a=this.dateDelta+this.timeDelta;return!(0>a)||this.startDateInput&&this.endDateInput||(a+=g),a},refresh:function(){if(this.startDateInput&&this.startDateInput.value&&this.endDateInput&&this.endDateInput.value){var a=this.settings.parseDate(this.startDateInput),b=this.settings.parseDate(this.endDateInput);a&&b&&(this.dateDelta=b.getTime()-a.getTime())}if(this.startTimeInput&&this.startTimeInput.value&&this.endTimeInput&&this.endTimeInput.value){var c=this.settings.parseTime(this.startTimeInput),d=this.settings.parseTime(this.endTimeInput);c&&d&&(this.timeDelta=d.getTime()-c.getTime(),this._updateEndMintime())}},remove:function(){this._unbindChangeHandler()},_bindChangeHandler:function(){h?h(this.container).on("change.datepair",h.proxy(this.handleEvent,this)):this.container.addEventListener("change",this,!1)},_unbindChangeHandler:function(){h?h(this.container).off("change.datepair"):this.container.removeEventListener("change",this,!1)},handleEvent:function(a){this._unbindChangeHandler(),e(a.target,this.settings.dateClass)?""!=a.target.value?(this._dateChanged(a.target),this._timeChanged(a.target)):this.dateDelta=null:e(a.target,this.settings.timeClass)&&(""!=a.target.value?this._timeChanged(a.target):this.timeDelta=null),this._validateRanges(),this._updateEndMintime(),this._bindChangeHandler()},_dateChanged:function(a){if(this.startDateInput&&this.endDateInput){var b=this.settings.parseDate(this.startDateInput),c=this.settings.parseDate(this.endDateInput);if(b&&c)if("start"==this.settings.anchor&&e(a,this.settings.startClass)){var d=new Date(b.getTime()+this.dateDelta);this.settings.updateDate(this.endDateInput,d)}else if("end"==this.settings.anchor&&e(a,this.settings.endClass)){var d=new Date(c.getTime()-this.dateDelta);this.settings.updateDate(this.startDateInput,d)}else if(b>c){var f=e(a,this.settings.startClass)?this.endDateInput:this.startDateInput,h=this.settings.parseDate(a);this.dateDelta=0,this.settings.updateDate(f,h)}else this.dateDelta=c.getTime()-b.getTime();else if(null!==this.settings.defaultDateDelta){if(b){var i=new Date(b.getTime()+this.settings.defaultDateDelta*g);this.settings.updateDate(this.endDateInput,i)}else if(c){var j=new Date(c.getTime()-this.settings.defaultDateDelta*g);this.settings.updateDate(this.startDateInput,j)}this.dateDelta=this.settings.defaultDateDelta*g}else this.dateDelta=null}},_timeChanged:function(a){if(this.startTimeInput&&this.endTimeInput){var b=this.settings.parseTime(this.startTimeInput),c=this.settings.parseTime(this.endTimeInput);if(b&&c)if("start"==this.settings.anchor&&e(a,this.settings.startClass)){var d=new Date(b.getTime()+this.timeDelta);this.settings.updateTime(this.endTimeInput,d),c=this.settings.parseTime(this.endTimeInput),this._doMidnightRollover(b,c)}else if("end"==this.settings.anchor&&e(a,this.settings.endClass)){var d=new Date(c.getTime()-this.timeDelta);this.settings.updateTime(this.startTimeInput,d),b=this.settings.parseTime(this.startTimeInput),this._doMidnightRollover(b,c)}else{this._doMidnightRollover(b,c);var f,g;if(this.startDateInput&&this.endDateInput&&(f=this.settings.parseDate(this.startDateInput),g=this.settings.parseDate(this.endDateInput)),+f==+g&&b>c){var h=e(a,this.settings.endClass)?this.endTimeInput:this.startTimeInput,i=e(a,this.settings.startClass)?this.endTimeInput:this.startTimeInput,j=this.settings.parseTime(h);this.timeDelta=0,this.settings.updateTime(i,j)}else this.timeDelta=c.getTime()-b.getTime()}else if(null!==this.settings.defaultTimeDelta){if(b){var k=new Date(b.getTime()+this.settings.defaultTimeDelta);this.settings.updateTime(this.endTimeInput,k)}else if(c){var l=new Date(c.getTime()-this.settings.defaultTimeDelta);this.settings.updateTime(this.startTimeInput,l)}this.timeDelta=this.settings.defaultTimeDelta}else this.timeDelta=null}},_doMidnightRollover:function(a,b){if(this.startDateInput&&this.endDateInput){var c=this.settings.parseDate(this.endDateInput),d=this.settings.parseDate(this.startDateInput),e=b.getTime()-a.getTime(),f=a>b?g:-1*g;null!==this.dateDelta&&this.dateDelta+this.timeDelta<=g&&this.dateDelta+e!=0&&(f>0||0!=this.dateDelta)&&(e>=0&&this.timeDelta<0||0>e&&this.timeDelta>=0)&&("start"==this.settings.anchor?(this.settings.updateDate(this.endDateInput,new Date(c.getTime()+f)),this._dateChanged(this.endDateInput)):"end"==this.settings.anchor&&(this.settings.updateDate(this.startDateInput,new Date(d.getTime()-f)),this._dateChanged(this.startDateInput))),this.timeDelta=e}},_updateEndMintime:function(){if("function"==typeof this.settings.setMinTime){var a=null;"start"==this.settings.anchor&&(!this.dateDelta||this.dateDelta<g||this.timeDelta&&this.dateDelta+this.timeDelta<g)&&(a=this.settings.parseTime(this.startTimeInput)),this.settings.setMinTime(this.endTimeInput,a)}},_validateRanges:function(){return this.startTimeInput&&this.endTimeInput&&null===this.timeDelta?void d(this.container,"rangeIncomplete"):this.startDateInput&&this.endDateInput&&null===this.dateDelta?void d(this.container,"rangeIncomplete"):void(!this.startDateInput||!this.endDateInput||this.dateDelta+this.timeDelta>=0?d(this.container,"rangeSelected"):d(this.container,"rangeError"))}},a.Datepair=f}(window,document),function(a){a&&(a.fn.datepair=function(b){var c;return this.each(function(){var d=a(this),e=d.data("datepair"),f="object"==typeof b&&b;e||(e=new Datepair(this,f),d.data("datepair",e)),"string"==typeof b&&(c=e[b]())}),c||this},a("[data-datepair]").each(function(){var b=a(this);b.datepair(b.data())}))}(window.Zepto||window.jQuery);
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset='utf-8'>
+
+ <title>Datepair.js – Demos and Documentation</title>
+ <meta name="description" content="A javascript plugin for intelligently selecting date and time ranges inspired by Google Calendar." />
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
+
+ <script src="https://jonthornton.github.io/jquery-timepicker/jquery.timepicker.js"></script>
+ <link rel="stylesheet" type="text/css" href="https://jonthornton.github.io/jquery-timepicker/jquery.timepicker.css" />
+
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>
+ <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.standalone.css" />
+
+ <script src="lib/pikaday.js"></script>
+ <link rel="stylesheet" type="text/css" href="lib/pikaday.css" />
+
+ <script src="lib/jquery.ptTimeSelect.js"></script>
+ <link rel="stylesheet" type="text/css" href="lib/jquery.ptTimeSelect.css" />
+ <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css" type="text/css" media="all" />
+
+ <script src="lib/moment.min.js"></script>
+ <script src="lib/site.js"></script>
+ <link rel="stylesheet" type="text/css" href="lib/site.css" />
+
+ <script src="dist/datepair.js"></script>
+ <script src="dist/jquery.datepair.js"></script>
+</head>
+
+<body>
+ <header>
+ <h1><a href="https://github.com/jonthornton/jquery-datepair">Datepair.js</a></h1>
+ <p>
+ A javascript plugin for intelligently selecting date and time ranges<br />
+ inspired by Google Calendar. <br />
+ </p>
+
+ <ul id="header-links">
+ <li><a href="https://github.com/jonthornton/jquery-datepair#datepair-plugin-for-jquery">Documentation</a></li>
+ <li><a href="https://github.com/jonthornton/jquery-datepair">Source code on GitHub</a></li>
+ <li><a href="https://github.com/jonthornton/jquery-datepair/zipball/master">Download (zip)</a></li>
+ <li><a href="https://github.com/jonthornton/jquery-datepair/issues?state=open">Help</a></li>
+ </ul>
+ </header>
+
+ <section>
+ <p>Use this plugin to link date and time inputs when you need to select ranges. <br />No dependencies, with optional support for jQuery/Zepto.</p>
+ </section>
+
+ <section id="examples">
+ <article>
+ <div class="demo">
+ <h2>Basic Example</h2>
+ <p>Datepair.js doesn't include any date or time picker widgets, but it's preconfigured to work with <a href="https://github.com/jonthornton/jquery-timepicker">jquery-timepicker</a> and <a href="https://github.com/eternicode/bootstrap-datepicker">Bootstrap Datepicker</a>. Include input widgets as you normally would, and then use Datepair.js to link them.</p>
+
+ <p id="basicExample">
+ <input type="text" class="date start" />
+ <input type="text" class="time start" /> to
+ <input type="text" class="time end" />
+ <input type="text" class="date end" />
+ </p>
+ </div>
+
+ <pre class="code" data-language="javascript">
+<p id="basicExample">
+ <input type="text" class="date start" />
+ <input type="text" class="time start" /> to
+ <input type="text" class="time end" />
+ <input type="text" class="date end" />
+</p>
+
+<!-- include input widgets; this is independent of Datepair.js -->
+<link rel="styleshee" type="text/css" href="jquery.timepicker.css" />
+<link rel="stylesheet" type="text/css" href="bootstrap-datepicker.css" />
+<script type="text/javascript" src="bootstrap-datepicker.js"></script>
+<script type="text/javascript" src="jquery.timepicker.js"></script>
+
+<script type="text/javascript" src="datepair.js"></script>
+<script>
+ // initialize input widgets first
+ $('#basicExample .time').timepicker({
+ 'showDuration': true,
+ 'timeFormat': 'g:ia'
+ });
+
+ $('#basicExample .date').datepicker({
+ 'format': 'm/d/yyyy',
+ 'autoclose': true
+ });
+
+ // initialize datepair
+ var basicExampleEl = document.getElementById('basicExample');
+ var datepair = new Datepair(basicExampleEl);
+</script>
+ </pre>
+
+ <script>
+ $('#basicExample .time').timepicker({
+ 'showDuration': true,
+ 'timeFormat': 'g:ia'
+ });
+
+ $('#basicExample .date').datepicker({
+ 'format': 'm/d/yyyy',
+ 'autoclose': true
+ });
+
+ var basicExampleEl = document.getElementById('basicExample');
+ var datepair = new Datepair(basicExampleEl);
+ </script>
+ </article>
+
+ <article>
+ <div class="demo">
+ <h2>jQuery Example</h2>
+ <p>Include the optional jquery.datepicker.js file to interact with Datepair.js with a jQuery interface.</p>
+
+ <p id="jqueryExample">
+ <input type="text" class="date start" />
+ <input type="text" class="time start" /> to
+ <input type="text" class="time end" />
+ <input type="text" class="date end" />
+ </p>
+ </div>
+
+ <pre class="code" data-language="javascript">
+<p id="basicExample">
+ <input type="text" class="date start" />
+ <input type="text" class="time start" /> to
+ <input type="text" class="time end" />
+ <input type="text" class="date end" />
+</p>
+
+<script type="text/javascript" src="datepair.js"></script>
+<script type="text/javascript" src="jquery.datepair.js"></script>
+<script>
+ // initialize input widgets first
+ $('#jqueryExample .time').timepicker({
+ 'showDuration': true,
+ 'timeFormat': 'g:ia'
+ });
+
+ $('#jqueryExample .date').datepicker({
+ 'format': 'm/d/yyyy',
+ 'autoclose': true
+ });
+
+ // initialize datepair
+ $('#jqueryExample').datepair();
+</script>
+ </pre>
+
+ <script>
+ $('#jqueryExample .time').timepicker({
+ 'showDuration': true,
+ 'timeFormat': 'g:ia'
+ });
+
+ $('#jqueryExample .date').datepicker({
+ 'format': 'm/d/yyyy',
+ 'autoclose': true
+ });
+
+ $('#jqueryExample').datepair();
+ </script>
+ </article>
+
+ <article>
+ <div class="demo">
+ <h2>Date-only Example</h2>
+
+ <p>You can use datepair with just dates, or just times.</p>
+
+ <p id="dateOnlyExample">
+ <input type="text" class="date start" /> to
+ <input type="text" class="date end" />
+ </p>
+
+ <p id="timeOnlyExample">
+ <input type="text" class="time start" /> to
+ <input type="text" class="time end" />
+ </p>
+ </div>
+
+ <pre class="code" data-language="javascript">
+// HTML not shown for brevity
+
+$('#timeOnlyExample .time').timepicker({
+ 'showDuration': true,
+ 'timeFormat': 'g:ia'
+});
+
+var timeOnlyExampleEl = document.getElementById('timeOnlyExample');
+var timeOnlyDatepair = new Datepair(timeOnlyExampleEl);
+
+$('#dateOnlyExample .date').datepicker({
+ 'format': 'yyyy-m-d',
+ 'autoclose': true
+});
+
+var dateOnlyExampleEl = document.getElementById('dateOnlyExample');
+var dateOnlyDatepair = new Datepair(dateOnlyExampleEl);
+ </pre>
+
+ <script>
+ $('#timeOnlyExample .time').timepicker({
+ 'showDuration': true,
+ 'timeFormat': 'g:ia'
+ });
+
+ var timeOnlyExampleEl = document.getElementById('timeOnlyExample');
+ var timeOnlyDatepair = new Datepair(timeOnlyExampleEl);
+
+ $('#dateOnlyExample .date').datepicker({
+ 'format': 'yyyy-m-d',
+ 'autoclose': true
+ });
+
+ var dateOnlyExampleEl = document.getElementById('dateOnlyExample');
+ var dateOnlyDatepair = new Datepair(dateOnlyExampleEl);
+ </script>
+ </article>
+
+ <article>
+ <div class="demo">
+ <h2>Default Delta Example</h2>
+
+ <p>Datepair can automatically set the other input when a first value is selected.</p>
+
+ <p id="defaultDeltaExample">
+ <input type="text" class="date start" />
+ <input type="text" class="time start" /> to
+ <input type="text" class="time end" />
+ <input type="text" class="date end" />
+ </p>
+ </div>
+
+ <pre class="code" data-language="javascript">
+// HTML not shown for brevity
+
+var defaultDeltaExampleEl = document.getElementById('defaultDeltaExample');
+var defaultDeltaDatepair = new Datepair(defaultDeltaExampleEl, {
+ 'defaultDateDelta': 1, // days
+ 'defaultTimeDelta': 7200000 // milliseconds
+});
+ </pre>
+
+ <script>
+ $('#defaultDeltaExample .time').timepicker({
+ 'showDuration': true,
+ 'timeFormat': 'g:ia'
+ });
+
+ $('#defaultDeltaExample .date').datepicker({
+ 'format': 'm/d/yyyy',
+ 'autoclose': true
+ });
+
+ var defaultDeltaExampleEl = document.getElementById('defaultDeltaExample');
+ var defaultDeltaDatepair = new Datepair(defaultDeltaExampleEl, {
+ 'defaultDateDelta': 1,
+ 'defaultTimeDelta': 7200000
+ });
+ </script>
+ </article>
+
+ <article>
+ <div class="demo">
+ <h2>Alternate UI Widgets Example</h2>
+
+ <p>jquery-datepair is widget agnostic and can work with any date and time pickers. Here's an example with <a href="http://pttimeselect.sourceforge.net/example/index.html">jQuery.ptTimeSelect</a> and <a href="https://github.com/dbushell/Pikaday">Pikaday</a>.</p>
+
+ <p id="alternateUiWidgetsExample">
+ <input type="text" class="date start" />
+ <input type="text" class="time start" /> to<br />
+ <input type="text" class="date end" />
+ <input type="text" class="time end" />
+ </p>
+ </div>
+
+ <pre class="code" data-language="javascript">
+<p id="alternateUiWidgetsExample">
+ <input type="text" class="date start" />
+ <input type="text" class="time start" /> to<br />
+ <input type="text" class="date end" />
+ <input type="text" class="time end" />
+</p>
+<script type="text/javascript" src="pikaday.js"></script>
+<script type="text/javascript" src="jquery.ptTimeSelect.js"></script>
+<script type="text/javascript" src="moment.js"></script>
+<script>
+ // initialize input widgets
+ // ptTimeSelect doesn't trigger change event by default
+ $('#alternateUiWidgetsExample .time').ptTimeSelect({
+ 'onClose': function($self) {
+ $self.trigger('change');
+ }
+ });
+
+ $('#alternateUiWidgetsExample .date').pikaday();
+
+ var TIMEFORMAT = 'h:mm a';
+ var alternateUiWidgetsExampleEl = document.getElementById('alternateUiWidgetsExample');
+ var alternateWidgetsDatepair = new Datepair(alternateUiWidgetsExampleEl, {
+ parseTime: function(input){
+ // use moment.js to parse time
+ var m = moment(input.value, TIMEFORMAT);
+ return m.toDate();
+ },
+ updateTime: function(input, dateObj){
+ var m = moment(dateObj);
+ input.value = m.format(TIMEFORMAT);
+ },
+ parseDate: function(input){
+ var picker = $(input).data('pikaday');
+ return picker.getDate();
+ },
+ updateDate: function(input, dateObj){
+ var picker = $(input).data('pikaday');
+ return picker.setDate(dateObj);
+ }
+ });
+</script>
+ </pre>
+
+ <script>
+ // initialize input widgets
+ // ptTimeSelect doesn't trigger change event by default
+ $('#alternateUiWidgetsExample .time').ptTimeSelect({
+ 'onClose': function($self) {
+ $self.trigger('change');
+ }
+ });
+
+ $('#alternateUiWidgetsExample .date').pikaday();
+
+ var TIMEFORMAT = 'h:mm a';
+ var alternateUiWidgetsExampleEl = document.getElementById('alternateUiWidgetsExample');
+ var alternateWidgetsDatepair = new Datepair(alternateUiWidgetsExampleEl, {
+ parseTime: function(input){
+ // use moment.js to parse time
+ var m = moment(input.value, TIMEFORMAT);
+ return m.toDate();
+ },
+ updateTime: function(input, dateObj){
+ var m = moment(dateObj);
+ input.value = m.format(TIMEFORMAT);
+ },
+ parseDate: function(input){
+ var picker = $(input).data('pikaday');
+ return picker.getDate();
+ },
+ updateDate: function(input, dateObj){
+ var picker = $(input).data('pikaday');
+ return picker.setDate(dateObj);
+ }
+ });
+ </script>
+ </article>
+
+ <article>
+ <div class="demo">
+ <h2>Events Example</h2>
+ <p>Datepair fires several events to indicate the status of the inputs.</p>
+
+ <p id="eventsExample">
+ <input type="text" class="date start" />
+ <input type="text" class="time start" /> to
+ <input type="text" class="time end" />
+ <input type="text" class="date end" />
+ </p>
+
+ <p id="eventsExampleStatus"></p>
+ </div>
+
+ <pre class="code" data-language="javascript">
+// HTML not shown for brevity
+
+// initialize input widgets first
+$('#eventsExample .time').timepicker({
+ 'showDuration': true,
+ 'timeFormat': 'g:ia'
+});
+
+$('#eventsExample .date').datepicker({
+ 'format': 'm/d/yyyy',
+ 'autoclose': true
+});
+
+var eventsExampleEl = document.getElementById('eventsExample');
+var eventsExampleDatepair = new Datepair(eventsExampleEl);
+
+// some sample handlers
+$('#eventsExample').on('rangeSelected', function(){
+ $('#eventsExampleStatus').text('Valid range selected');
+}).on('rangeIncomplete', function(){
+ $('#eventsExampleStatus').text('Incomplete range');
+}).on('rangeError', function(){
+ $('#eventsExampleStatus').text('Invalid range');
+});
+ </pre>
+
+ <script>
+ $('#eventsExample .time').timepicker({
+ 'showDuration': true,
+ 'timeFormat': 'g:ia'
+ });
+
+ $('#eventsExample .date').datepicker({
+ 'format': 'm/d/yyyy',
+ 'autoclose': true
+ });
+
+ var eventsExampleEl = document.getElementById('eventsExample');
+ var eventsExampleDatepair = new Datepair(eventsExampleEl);
+
+ $('#eventsExample').on('rangeSelected', function(){
+ $('#eventsExampleStatus').text('Valid range selected');
+ }).on('rangeIncomplete', function(){
+ $('#eventsExampleStatus').text('Incomplete range');
+ }).on('rangeError', function(){
+ $('#eventsExampleStatus').text('Invalid range');
+ });
+ </script>
+ </article>
+
+ <article>
+ <div class="demo">
+ <h2>Anchor Example</h2>
+ <p>Datepair defaults to move the end time/date based on changes to the start time/date. This can be changed to the end inputs, or disabled completely.</p>
+
+ <p>Anchor:
+ <select id="anchorSelect">
+ <option value="start">Start</option>
+ <option value="end">End</option>
+ <option value="">Null</option>
+ </select>
+ </p>
+ <p id="anchorExample">
+ <input type="text" class="date start" />
+ <input type="text" class="time start" /> to
+ <input type="text" class="time end" />
+ <input type="text" class="date end" />
+ </p>
+ </div>
+
+ <pre class="code" data-language="javascript">
+var anchorExampleEl = document.getElementById('anchorExample');
+var anchorDatepair = new Datepair(anchorExampleEl, {
+ anchor: $('#anchorSelect').val()
+});
+
+$('#anchorSelect').on('change', function(){
+ anchorDatepair.option('anchor', $('#anchorSelect').val());
+});
+ </pre>
+
+ <script>
+ $('#anchorExample .time').timepicker({
+ 'showDuration': true,
+ 'timeFormat': 'g:ia'
+ });
+
+ $('#anchorExample .date').datepicker({
+ 'format': 'm/d/yyyy',
+ 'autoclose': true
+ });
+
+ var anchorExampleEl = document.getElementById('anchorExample');
+ var anchorDatepair = new Datepair(anchorExampleEl, {
+ anchor: $('#anchorSelect').val()
+ });
+
+ $('#anchorSelect').on('change', function(){
+ anchorDatepair.option('anchor', $('#anchorSelect').val());
+ });
+
+ </script>
+ </article>
+ </section>
+
+ <section>
+ <h2>Need Help?</h2>
+ <p>Check <a href="https://github.com/jonthornton/jquery-datepair#datepair-plugin-for-jquery">the documenation</a> or <a href="https://github.com/jonthornton/jquery-datepair/issues?state=open">submit an issue</a> on GitHub.</p>
+ </section>
+
+ <footer>
+ <p>© 2014 <a href="http://jonthornton.com">Jon Thornton</a></p>
+ </footer>
+
+ <script>
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
+
+ ga('create', 'UA-15605525-4', 'auto');
+ ga('send', 'pageview');
+ </script>
+
+</body>
+</html>
--- /dev/null
+/**
+ * FILE: jquery.ptTileSelect.css
+ * Default style for the timeselect container.
+ *
+ * LAST UPDATED:
+ *
+ * - $Date: 2009/04/12 20:23:02 $
+ * - $Author: paulinho4u $
+ * - $Revision: 1.1 $
+ */
+#ptTimeSelectCntr {
+ width: 250px;
+ font-size: .9em;
+ position: absolute;
+ z-index: 10;
+ display: none;
+}
+#ptTimeSelectCntr .ui-widget{
+ padding: .2em;
+}
+#ptTimeSelectCntr .ui-widget-header {
+ padding: .2em;
+}
+#ptTimeSelectCntr #ptTimeSelectUserTime {
+ font-size: larger;
+ padding: .2em;
+ padding-left: 1em;
+ text-align: center;
+}
+#ptTimeSelectCntr #ptTimeSelectCloseCntr {
+ display: block;
+ padding: .2em;
+}
+#ptTimeSelectCntr #ptTimeSelectCloseCntr a {
+ display: block;
+ padding: .2em;
+}
+#ptTimeSelectCntr .ui-widget-content {
+ margin-top: .1em;
+ margin-bottom: .1em;
+ padding: .2em;
+}
+#ptTimeSelectCntr .ui-widget.ui-widget-content {
+ margin-top: 0;
+}
+#ptTimeSelectCntr .ptTimeSelectLeftPane.ui-widget-content {
+ border-top:none;
+ border-bottom:none;
+ border-left:none;
+ border-right-width: 2px;
+}
+#ptTimeSelectCntr .ptTimeSelectRightPane.ui-widget-content {
+ border: none;
+}
+#ptTimeSelectCntr .ptTimeSelectHrCntr a,
+#ptTimeSelectCntr .ptTimeSelectMinCntr a {
+ display: block;
+ float: left;
+ padding: .2em;
+ width: 1.9em;
+ margin: 1px;
+ text-align: center;
+ text-decoration: none;
+}
+#ptTimeSelectCntr .ptTimeSelectHrAmPmCntr a {
+ text-align: center;
+ margin: 1px;
+}
+#ptTimeSelectCntr .ptTimeSelectTimeLabelsCntr {
+ font-weight: bold;
+ font-size: .9em;
+}
+#ptTimeSelectCntr #ptTimeSelectSetButton {
+ padding-top: .2em;
+ padding-bottom: .2em;
+}
+#ptTimeSelectCntr #ptTimeSelectSetButton a {
+ display: block;
+ padding: .2em;
+ width: 30%;
+ text-align: center;
+ float: right;
+}
--- /dev/null
+/**
+ * FILE: jQuery.ptTileSelect.js
+ *
+ * @fileOverview
+ * jQuery plugin for displaying a popup that allows a user
+ * to define a time and set that time back to a form's input
+ * field.
+ *
+ * @version 0.8
+ * @author Paul Tavares, www.purtuga.com
+ * @see http://pttimeselect.sourceforge.net
+ *
+ * @requires jQuery {@link http://www.jquery.com}
+ *
+ *
+ * LICENSE:
+ *
+ * Copyright (c) 2007 Paul T. (purtuga.com)
+ * Dual licensed under the:
+ *
+ * - MIT
+ * <http://www.opensource.org/licenses/mit-license.php>
+ *
+ * - GPL
+ * <http://www.opensource.org/licenses/gpl-license.php>
+ *
+ * User can pick whichever one applies best for their project
+ * and doesn not have to contact me.
+ *
+ *
+ * INSTALLATION:
+ *
+ * There are two files (.css and .js) delivered with this plugin and
+ * that must be included in your html page after the jquery.js library
+ * and the jQuery UI style sheet (the jQuery UI javascript library is
+ * not necessary).
+ * Both of these are to be included inside of the 'head' element of
+ * the document. Example below demonstrates this along side the jQuery
+ * libraries.
+ *
+ * | <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
+ * | <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.22/themes/redmond/jquery-ui.css" />
+ * |
+ * | <link rel="stylesheet" type="text/css" href="jquery.ptTimeSelect.css" />
+ * | <script type="text/javascript" src="jquery.ptTimeSelect.js"></script>
+ * |
+ *
+ * USAGE:
+ *
+ * - See <$(ele).ptTimeSelect()>
+ *
+ *
+ *
+ * LAST UPDATED:
+ *
+ * - $Date: 2012/08/05 19:40:21 $
+ * - $Author: paulinho4u $
+ * - $Revision: 1.8 $
+ *
+ */
+
+(function($){
+
+ /**
+ * jQuery definition
+ *
+ * @see http://jquery.com/
+ * @name jQuery
+ * @class jQuery Library
+ */
+
+ /**
+ * jQuery 'fn' definition to anchor all public plugin methods.
+ *
+ * @see http://jquery.com/
+ * @name fn
+ * @class jQuery Library public method anchor
+ * @memberOf jQuery
+ */
+
+ /**
+ * Namespace for all properties and methods
+ *
+ * @namespace ptTimeSelect
+ * @memberOf jQuery
+ */
+ jQuery.ptTimeSelect = {};
+ jQuery.ptTimeSelect.version = "__BUILD_VERSION_NUMBER__";
+
+ /**
+ * The default options for all calls to ptTimeSelect. Can be
+ * overwriten with each individual call to {@link jQuery.fn.ptTimeSelect}
+ *
+ * @type {Object} options
+ * @memberOf jQuery.ptTimeSelect
+ * @see jQuery.fn.ptTimeSelect
+ */
+ jQuery.ptTimeSelect.options = {
+ containerClass: undefined,
+ containerWidth: '22em',
+ hoursLabel: 'Hour',
+ minutesLabel: 'Minutes',
+ setButtonLabel: 'Set',
+ popupImage: undefined,
+ onFocusDisplay: true,
+ zIndex: 10,
+ onBeforeShow: undefined,
+ onClose: undefined
+ };
+
+ /**
+ * Internal method. Called when page is initialized to add the time
+ * selection area to the DOM.
+ *
+ * @private
+ * @memberOf jQuery.ptTimeSelect
+ * @return {undefined}
+ */
+ jQuery.ptTimeSelect._ptTimeSelectInit = function () {
+ jQuery(document).ready(
+ function () {
+ //if the html is not yet created in the document, then do it now
+ if (!jQuery('#ptTimeSelectCntr').length) {
+ jQuery("body").append(
+ '<div id="ptTimeSelectCntr" class="">'
+ + ' <div class="ui-widget ui-widget-content ui-corner-all">'
+ + ' <div class="ui-widget-header ui-corner-all">'
+ + ' <div id="ptTimeSelectCloseCntr" style="float: right;">'
+ + ' <a href="javascript: void(0);" onclick="jQuery.ptTimeSelect.closeCntr();" '
+ + ' onmouseover="jQuery(this).removeClass(\'ui-state-default\').addClass(\'ui-state-hover\');" '
+ + ' onmouseout="jQuery(this).removeClass(\'ui-state-hover\').addClass(\'ui-state-default\');"'
+ + ' class="ui-corner-all ui-state-default">'
+ + ' <span class="ui-icon ui-icon-circle-close">X</span>'
+ + ' </a>'
+ + ' </div>'
+ + ' <div id="ptTimeSelectUserTime" style="float: left;">'
+ + ' <span id="ptTimeSelectUserSelHr">1</span> : '
+ + ' <span id="ptTimeSelectUserSelMin">00</span> '
+ + ' <span id="ptTimeSelectUserSelAmPm">AM</span>'
+ + ' </div>'
+ + ' <br style="clear: both;" /><div></div>'
+ + ' </div>'
+ + ' <div class="ui-widget-content ui-corner-all">'
+ + ' <div>'
+ + ' <div class="ptTimeSelectTimeLabelsCntr">'
+ + ' <div class="ptTimeSelectLeftPane" style="width: 50%; text-align: center; float: left;" class="">Hour</div>'
+ + ' <div class="ptTimeSelectRightPane" style="width: 50%; text-align: center; float: left;">Minutes</div>'
+ + ' </div>'
+ + ' <div>'
+ + ' <div style="float: left; width: 50%;">'
+ + ' <div class="ui-widget-content ptTimeSelectLeftPane">'
+ + ' <div class="ptTimeSelectHrAmPmCntr">'
+ + ' <a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);" '
+ + ' style="display: block; width: 45%; float: left;">AM</a>'
+ + ' <a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);" '
+ + ' style="display: block; width: 45%; float: left;">PM</a>'
+ + ' <br style="clear: left;" /><div></div>'
+ + ' </div>'
+ + ' <div class="ptTimeSelectHrCntr">'
+ + ' <a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">1</a>'
+ + ' <a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">2</a>'
+ + ' <a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">3</a>'
+ + ' <a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">4</a>'
+ + ' <a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">5</a>'
+ + ' <a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">6</a>'
+ + ' <a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">7</a>'
+ + ' <a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">8</a>'
+ + ' <a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">9</a>'
+ + ' <a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">10</a>'
+ + ' <a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">11</a>'
+ + ' <a class="ptTimeSelectHr ui-state-default" href="javascript: void(0);">12</a>'
+ + ' <br style="clear: left;" /><div></div>'
+ + ' </div>'
+ + ' </div>'
+ + ' </div>'
+ + ' <div style="width: 50%; float: left;">'
+ + ' <div class="ui-widget-content ptTimeSelectRightPane">'
+ + ' <div class="ptTimeSelectMinCntr">'
+ + ' <a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">00</a>'
+ + ' <a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">05</a>'
+ + ' <a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">10</a>'
+ + ' <a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">15</a>'
+ + ' <a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">20</a>'
+ + ' <a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">25</a>'
+ + ' <a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">30</a>'
+ + ' <a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">35</a>'
+ + ' <a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">40</a>'
+ + ' <a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">45</a>'
+ + ' <a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">50</a>'
+ + ' <a class="ptTimeSelectMin ui-state-default" href="javascript: void(0);">55</a>'
+ + ' <br style="clear: left;" /><div></div>'
+ + ' </div>'
+ + ' </div>'
+ + ' </div>'
+ + ' </div>'
+ + ' </div>'
+ + ' <div style="clear: left;"></div>'
+ + ' </div>'
+ + ' <div id="ptTimeSelectSetButton">'
+ + ' <a href="javascript: void(0);" onclick="jQuery.ptTimeSelect.setTime()"'
+ + ' onmouseover="jQuery(this).removeClass(\'ui-state-default\').addClass(\'ui-state-hover\');" '
+ + ' onmouseout="jQuery(this).removeClass(\'ui-state-hover\').addClass(\'ui-state-default\');"'
+ + ' class="ui-corner-all ui-state-default">'
+ + ' SET'
+ + ' </a>'
+ + ' <br style="clear: both;" /><div></div>'
+ + ' </div>'
+ + ' <!--[if lte IE 6.5]>'
+ + ' <iframe style="display:block; position:absolute;top: 0;left:0;z-index:-1;'
+ + ' filter:Alpha(Opacity=\'0\');width:3000px;height:3000px"></iframe>'
+ + ' <![endif]-->'
+ + ' </div></div>'
+ );
+
+ var e = jQuery('#ptTimeSelectCntr');
+
+ // Add the events to the functions
+ e.find('.ptTimeSelectMin')
+ .bind("click", function(){
+ jQuery.ptTimeSelect.setMin($(this).text());
+ });
+
+ e.find('.ptTimeSelectHr')
+ .bind("click", function(){
+ jQuery.ptTimeSelect.setHr($(this).text());
+ });
+
+ $(document).mousedown(jQuery.ptTimeSelect._doCheckMouseClick);
+ }//end if
+ }
+ );
+ }();// jQuery.ptTimeSelectInit()
+
+
+ /**
+ * Sets the hour selected by the user on the popup.
+ *
+ * @private
+ * @param {Integer} h - Interger indicating the hour. This value
+ * is the same as the text value displayed on the
+ * popup under the hour. This value can also be the
+ * words AM or PM.
+ * @return {undefined}
+ *
+ */
+ jQuery.ptTimeSelect.setHr = function(h) {
+ if ( h.toLowerCase() == "am"
+ || h.toLowerCase() == "pm"
+ ) {
+ jQuery('#ptTimeSelectUserSelAmPm').empty().append(h);
+ } else {
+ jQuery('#ptTimeSelectUserSelHr').empty().append(h);
+ }
+ };// END setHr() function
+
+ /**
+ * Sets the minutes selected by the user on the popup.
+ *
+ * @private
+ * @param {Integer} m - interger indicating the minutes. This
+ * value is the same as the text value displayed on the popup
+ * under the minutes.
+ * @return {undefined}
+ */
+ jQuery.ptTimeSelect.setMin = function(m) {
+ jQuery('#ptTimeSelectUserSelMin').empty().append(m);
+ };// END setMin() function
+
+ /**
+ * Takes the time defined by the user and sets it to the input
+ * element that the popup is currently opened for.
+ *
+ * @private
+ * @return {undefined}
+ */
+ jQuery.ptTimeSelect.setTime = function() {
+ var tSel = jQuery('#ptTimeSelectUserSelHr').text()
+ + ":"
+ + jQuery('#ptTimeSelectUserSelMin').text()
+ + " "
+ + jQuery('#ptTimeSelectUserSelAmPm').text();
+ jQuery(".isPtTimeSelectActive").val(tSel);
+ this.closeCntr();
+
+ };// END setTime() function
+
+ /**
+ * Displays the time definition area on the page, right below
+ * the input field. Also sets the custom colors/css on the
+ * displayed area to what ever the input element options were
+ * set with.
+ *
+ * @private
+ * @param {String} uId - Id of the element for whom the area will
+ * be displayed. This ID was created when the
+ * ptTimeSelect() method was called.
+ * @return {undefined}
+ *
+ */
+ jQuery.ptTimeSelect.openCntr = function (ele) {
+ jQuery.ptTimeSelect.closeCntr();
+ jQuery(".isPtTimeSelectActive").removeClass("isPtTimeSelectActive");
+ var cntr = jQuery("#ptTimeSelectCntr");
+ var i = jQuery(ele).eq(0).addClass("isPtTimeSelectActive");
+ var opt = i.data("ptTimeSelectOptions");
+ var style = i.offset();
+ style['z-index'] = opt.zIndex;
+ style.top = (style.top + i.outerHeight());
+ if (opt.containerWidth) {
+ style.width = opt.containerWidth;
+ }
+ if (opt.containerClass) {
+ cntr.addClass(opt.containerClass);
+ }
+ cntr.css(style);
+ var hr = 1;
+ var min = '00';
+ var tm = 'AM';
+ if (i.val()) {
+ var re = /([0-9]{1,2}).*:.*([0-9]{2}).*(PM|AM)/i;
+ var match = re.exec(i.val());
+ if (match) {
+ hr = match[1] || 1;
+ min = match[2] || '00';
+ tm = match[3] || 'AM';
+ }
+ }
+ cntr.find("#ptTimeSelectUserSelHr").empty().append(hr);
+ cntr.find("#ptTimeSelectUserSelMin").empty().append(min);
+ cntr.find("#ptTimeSelectUserSelAmPm").empty().append(tm);
+ cntr.find(".ptTimeSelectTimeLabelsCntr .ptTimeSelectLeftPane")
+ .empty().append(opt.hoursLabel);
+ cntr.find(".ptTimeSelectTimeLabelsCntr .ptTimeSelectRightPane")
+ .empty().append(opt.minutesLabel);
+ cntr.find("#ptTimeSelectSetButton a").empty().append(opt.setButtonLabel);
+ if (opt.onBeforeShow) {
+ opt.onBeforeShow(i, cntr);
+ }
+ cntr.slideDown("fast");
+
+ };// END openCntr()
+
+ /**
+ * Closes (hides it) the popup container.
+ * @private
+ * @param {Object} i - Optional. The input field for which the
+ * container is being closed.
+ * @return {undefined}
+ */
+ jQuery.ptTimeSelect.closeCntr = function(i) {
+ var e = $("#ptTimeSelectCntr");
+ if (e.is(":visible") == true) {
+
+ // If IE, then check to make sure it is realy visible
+ if (jQuery.support.tbody == false) {
+ if (!(e[0].offsetWidth > 0) && !(e[0].offsetHeight > 0) ) {
+ return;
+ }
+ }
+
+ jQuery('#ptTimeSelectCntr')
+ .css("display", "none")
+ .removeClass()
+ .css("width", "");
+ if (!i) {
+ i = $(".isPtTimeSelectActive");
+ }
+ if (i) {
+ var opt = i.removeClass("isPtTimeSelectActive")
+ .data("ptTimeSelectOptions");
+ if (opt && opt.onClose) {
+ opt.onClose(i);
+ }
+ }
+ }
+ return;
+ };//end closeCntr()
+
+ /**
+ * Closes the timePicker popup if user is not longer focused on the
+ * input field or the timepicker
+ *
+ * @private
+ * @param {jQueryEvent} ev - Event passed in by jQuery
+ * @return {undefined}
+ */
+ jQuery.ptTimeSelect._doCheckMouseClick = function(ev){
+ if (!$("#ptTimeSelectCntr:visible").length) {
+ return;
+ }
+ if ( !jQuery(ev.target).closest("#ptTimeSelectCntr").length
+ && jQuery(ev.target).not("input.isPtTimeSelectActive").length ){
+ jQuery.ptTimeSelect.closeCntr();
+ }
+
+ };// jQuery.ptTimeSelect._doCheckMouseClick
+
+ /**
+ * FUNCTION: $().ptTimeSelect()
+ * Attaches a ptTimeSelect widget to each matched element. Matched
+ * elements must be input fields that accept a values (input field).
+ * Each element, when focused upon, will display a time selection
+ * popoup where the user can define a time.
+ *
+ * @memberOf jQuery
+ *
+ * PARAMS:
+ *
+ * @param {Object} [opt] - An object with the options for the time selection widget.
+ *
+ * @param {String} [opt.containerClass=""] - A class to be associated with the popup widget.
+ *
+ * @param {String} [opt.containerWidth=""] - Css width for the container.
+ *
+ * @param {String} [opt.hoursLabel="Hours"] - Label for the Hours.
+ *
+ * @param {String} [opt.minutesLabel="Minutes"] - Label for the Mintues container.
+ *
+ * @param {String} [opt.setButtonLabel="Set"] - Label for the Set button.
+ *
+ * @param {String} [opt.popupImage=""] - The html element (ex. img or text) to be appended next to each
+ * input field and that will display the time select widget upon
+ * click.
+ *
+ * @param {Integer} [opt.zIndex=10] - Integer for the popup widget z-index.
+ *
+ * @param {Function} [opt.onBeforeShow=undefined] - Function to be called before the widget is made visible to the
+ * user. Function is passed 2 arguments: 1) the input field as a
+ * jquery object and 2) the popup widget as a jquery object.
+ *
+ * @param {Function} [opt.onClose=undefined] - Function to be called after closing the popup widget. Function
+ * is passed 1 argument: the input field as a jquery object.
+ *
+ * @param {Bollean} [opt.onFocusDisplay=true] - True or False indicating if popup is auto displayed upon focus
+ * of the input field.
+ *
+ *
+ * RETURN:
+ * @return {jQuery} selection
+ *
+ *
+ *
+ * EXAMPLE:
+ * @example
+ * $('#fooTime').ptTimeSelect();
+ *
+ */
+ jQuery.fn.ptTimeSelect = function (opt) {
+ return this.each(function(){
+ if(this.nodeName.toLowerCase() != 'input') return;
+ var e = jQuery(this);
+ if (e.hasClass('hasPtTimeSelect')){
+ return this;
+ }
+ var thisOpt = {};
+ thisOpt = $.extend(thisOpt, jQuery.ptTimeSelect.options, opt);
+ e.addClass('hasPtTimeSelect').data("ptTimeSelectOptions", thisOpt);
+
+ //Wrap the input field in a <div> element with
+ // a unique id for later referencing.
+ if (thisOpt.popupImage || !thisOpt.onFocusDisplay) {
+ var img = jQuery('<span> </span><a href="javascript:" onclick="' +
+ 'jQuery.ptTimeSelect.openCntr(jQuery(this).data(\'ptTimeSelectEle\'));">' +
+ thisOpt.popupImage + '</a>'
+ )
+ .data("ptTimeSelectEle", e);
+ e.after(img);
+ }
+ if (thisOpt.onFocusDisplay){
+ e.focus(function(){
+ jQuery.ptTimeSelect.openCntr(this);
+ });
+ }
+ return this;
+ });
+ };// End of jQuery.fn.ptTimeSelect
+
+})(jQuery);
--- /dev/null
+//! moment.js
+//! version : 2.5.1
+//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
+//! license : MIT
+//! momentjs.com
+(function(a){function b(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function c(a,b){return function(c){return k(a.call(this,c),b)}}function d(a,b){return function(c){return this.lang().ordinal(a.call(this,c),b)}}function e(){}function f(a){w(a),h(this,a)}function g(a){var b=q(a),c=b.year||0,d=b.month||0,e=b.week||0,f=b.day||0,g=b.hour||0,h=b.minute||0,i=b.second||0,j=b.millisecond||0;this._milliseconds=+j+1e3*i+6e4*h+36e5*g,this._days=+f+7*e,this._months=+d+12*c,this._data={},this._bubble()}function h(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return b.hasOwnProperty("toString")&&(a.toString=b.toString),b.hasOwnProperty("valueOf")&&(a.valueOf=b.valueOf),a}function i(a){var b,c={};for(b in a)a.hasOwnProperty(b)&&qb.hasOwnProperty(b)&&(c[b]=a[b]);return c}function j(a){return 0>a?Math.ceil(a):Math.floor(a)}function k(a,b,c){for(var d=""+Math.abs(a),e=a>=0;d.length<b;)d="0"+d;return(e?c?"+":"":"-")+d}function l(a,b,c,d){var e,f,g=b._milliseconds,h=b._days,i=b._months;g&&a._d.setTime(+a._d+g*c),(h||i)&&(e=a.minute(),f=a.hour()),h&&a.date(a.date()+h*c),i&&a.month(a.month()+i*c),g&&!d&&db.updateOffset(a),(h||i)&&(a.minute(e),a.hour(f))}function m(a){return"[object Array]"===Object.prototype.toString.call(a)}function n(a){return"[object Date]"===Object.prototype.toString.call(a)||a instanceof Date}function o(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&s(a[d])!==s(b[d]))&&g++;return g+f}function p(a){if(a){var b=a.toLowerCase().replace(/(.)s$/,"$1");a=Tb[a]||Ub[b]||b}return a}function q(a){var b,c,d={};for(c in a)a.hasOwnProperty(c)&&(b=p(c),b&&(d[b]=a[c]));return d}function r(b){var c,d;if(0===b.indexOf("week"))c=7,d="day";else{if(0!==b.indexOf("month"))return;c=12,d="month"}db[b]=function(e,f){var g,h,i=db.fn._lang[b],j=[];if("number"==typeof e&&(f=e,e=a),h=function(a){var b=db().utc().set(d,a);return i.call(db.fn._lang,b,e||"")},null!=f)return h(f);for(g=0;c>g;g++)j.push(h(g));return j}}function s(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function t(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function u(a){return v(a)?366:365}function v(a){return a%4===0&&a%100!==0||a%400===0}function w(a){var b;a._a&&-2===a._pf.overflow&&(b=a._a[jb]<0||a._a[jb]>11?jb:a._a[kb]<1||a._a[kb]>t(a._a[ib],a._a[jb])?kb:a._a[lb]<0||a._a[lb]>23?lb:a._a[mb]<0||a._a[mb]>59?mb:a._a[nb]<0||a._a[nb]>59?nb:a._a[ob]<0||a._a[ob]>999?ob:-1,a._pf._overflowDayOfYear&&(ib>b||b>kb)&&(b=kb),a._pf.overflow=b)}function x(a){return null==a._isValid&&(a._isValid=!isNaN(a._d.getTime())&&a._pf.overflow<0&&!a._pf.empty&&!a._pf.invalidMonth&&!a._pf.nullInput&&!a._pf.invalidFormat&&!a._pf.userInvalidated,a._strict&&(a._isValid=a._isValid&&0===a._pf.charsLeftOver&&0===a._pf.unusedTokens.length)),a._isValid}function y(a){return a?a.toLowerCase().replace("_","-"):a}function z(a,b){return b._isUTC?db(a).zone(b._offset||0):db(a).local()}function A(a,b){return b.abbr=a,pb[a]||(pb[a]=new e),pb[a].set(b),pb[a]}function B(a){delete pb[a]}function C(a){var b,c,d,e,f=0,g=function(a){if(!pb[a]&&rb)try{require("./lang/"+a)}catch(b){}return pb[a]};if(!a)return db.fn._lang;if(!m(a)){if(c=g(a))return c;a=[a]}for(;f<a.length;){for(e=y(a[f]).split("-"),b=e.length,d=y(a[f+1]),d=d?d.split("-"):null;b>0;){if(c=g(e.slice(0,b).join("-")))return c;if(d&&d.length>=b&&o(e,d,!0)>=b-1)break;b--}f++}return db.fn._lang}function D(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function E(a){var b,c,d=a.match(vb);for(b=0,c=d.length;c>b;b++)d[b]=Yb[d[b]]?Yb[d[b]]:D(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function F(a,b){return a.isValid()?(b=G(b,a.lang()),Vb[b]||(Vb[b]=E(b)),Vb[b](a)):a.lang().invalidDate()}function G(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(wb.lastIndex=0;d>=0&&wb.test(a);)a=a.replace(wb,c),wb.lastIndex=0,d-=1;return a}function H(a,b){var c,d=b._strict;switch(a){case"DDDD":return Ib;case"YYYY":case"GGGG":case"gggg":return d?Jb:zb;case"Y":case"G":case"g":return Lb;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return d?Kb:Ab;case"S":if(d)return Gb;case"SS":if(d)return Hb;case"SSS":if(d)return Ib;case"DDD":return yb;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return Cb;case"a":case"A":return C(b._l)._meridiemParse;case"X":return Fb;case"Z":case"ZZ":return Db;case"T":return Eb;case"SSSS":return Bb;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return d?Hb:xb;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return xb;default:return c=new RegExp(P(O(a.replace("\\","")),"i"))}}function I(a){a=a||"";var b=a.match(Db)||[],c=b[b.length-1]||[],d=(c+"").match(Qb)||["-",0,0],e=+(60*d[1])+s(d[2]);return"+"===d[0]?-e:e}function J(a,b,c){var d,e=c._a;switch(a){case"M":case"MM":null!=b&&(e[jb]=s(b)-1);break;case"MMM":case"MMMM":d=C(c._l).monthsParse(b),null!=d?e[jb]=d:c._pf.invalidMonth=b;break;case"D":case"DD":null!=b&&(e[kb]=s(b));break;case"DDD":case"DDDD":null!=b&&(c._dayOfYear=s(b));break;case"YY":e[ib]=s(b)+(s(b)>68?1900:2e3);break;case"YYYY":case"YYYYY":case"YYYYYY":e[ib]=s(b);break;case"a":case"A":c._isPm=C(c._l).isPM(b);break;case"H":case"HH":case"h":case"hh":e[lb]=s(b);break;case"m":case"mm":e[mb]=s(b);break;case"s":case"ss":e[nb]=s(b);break;case"S":case"SS":case"SSS":case"SSSS":e[ob]=s(1e3*("0."+b));break;case"X":c._d=new Date(1e3*parseFloat(b));break;case"Z":case"ZZ":c._useUTC=!0,c._tzm=I(b);break;case"w":case"ww":case"W":case"WW":case"d":case"dd":case"ddd":case"dddd":case"e":case"E":a=a.substr(0,1);case"gg":case"gggg":case"GG":case"GGGG":case"GGGGG":a=a.substr(0,2),b&&(c._w=c._w||{},c._w[a]=b)}}function K(a){var b,c,d,e,f,g,h,i,j,k,l=[];if(!a._d){for(d=M(a),a._w&&null==a._a[kb]&&null==a._a[jb]&&(f=function(b){var c=parseInt(b,10);return b?b.length<3?c>68?1900+c:2e3+c:c:null==a._a[ib]?db().weekYear():a._a[ib]},g=a._w,null!=g.GG||null!=g.W||null!=g.E?h=Z(f(g.GG),g.W||1,g.E,4,1):(i=C(a._l),j=null!=g.d?V(g.d,i):null!=g.e?parseInt(g.e,10)+i._week.dow:0,k=parseInt(g.w,10)||1,null!=g.d&&j<i._week.dow&&k++,h=Z(f(g.gg),k,j,i._week.doy,i._week.dow)),a._a[ib]=h.year,a._dayOfYear=h.dayOfYear),a._dayOfYear&&(e=null==a._a[ib]?d[ib]:a._a[ib],a._dayOfYear>u(e)&&(a._pf._overflowDayOfYear=!0),c=U(e,0,a._dayOfYear),a._a[jb]=c.getUTCMonth(),a._a[kb]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=l[b]=d[b];for(;7>b;b++)a._a[b]=l[b]=null==a._a[b]?2===b?1:0:a._a[b];l[lb]+=s((a._tzm||0)/60),l[mb]+=s((a._tzm||0)%60),a._d=(a._useUTC?U:T).apply(null,l)}}function L(a){var b;a._d||(b=q(a._i),a._a=[b.year,b.month,b.day,b.hour,b.minute,b.second,b.millisecond],K(a))}function M(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function N(a){a._a=[],a._pf.empty=!0;var b,c,d,e,f,g=C(a._l),h=""+a._i,i=h.length,j=0;for(d=G(a._f,g).match(vb)||[],b=0;b<d.length;b++)e=d[b],c=(h.match(H(e,a))||[])[0],c&&(f=h.substr(0,h.indexOf(c)),f.length>0&&a._pf.unusedInput.push(f),h=h.slice(h.indexOf(c)+c.length),j+=c.length),Yb[e]?(c?a._pf.empty=!1:a._pf.unusedTokens.push(e),J(e,c,a)):a._strict&&!c&&a._pf.unusedTokens.push(e);a._pf.charsLeftOver=i-j,h.length>0&&a._pf.unusedInput.push(h),a._isPm&&a._a[lb]<12&&(a._a[lb]+=12),a._isPm===!1&&12===a._a[lb]&&(a._a[lb]=0),K(a),w(a)}function O(a){return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e})}function P(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Q(a){var c,d,e,f,g;if(0===a._f.length)return a._pf.invalidFormat=!0,a._d=new Date(0/0),void 0;for(f=0;f<a._f.length;f++)g=0,c=h({},a),c._pf=b(),c._f=a._f[f],N(c),x(c)&&(g+=c._pf.charsLeftOver,g+=10*c._pf.unusedTokens.length,c._pf.score=g,(null==e||e>g)&&(e=g,d=c));h(a,d||c)}function R(a){var b,c,d=a._i,e=Mb.exec(d);if(e){for(a._pf.iso=!0,b=0,c=Ob.length;c>b;b++)if(Ob[b][1].exec(d)){a._f=Ob[b][0]+(e[6]||" ");break}for(b=0,c=Pb.length;c>b;b++)if(Pb[b][1].exec(d)){a._f+=Pb[b][0];break}d.match(Db)&&(a._f+="Z"),N(a)}else a._d=new Date(d)}function S(b){var c=b._i,d=sb.exec(c);c===a?b._d=new Date:d?b._d=new Date(+d[1]):"string"==typeof c?R(b):m(c)?(b._a=c.slice(0),K(b)):n(c)?b._d=new Date(+c):"object"==typeof c?L(b):b._d=new Date(c)}function T(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function U(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function V(a,b){if("string"==typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!=typeof a)return null}else a=parseInt(a,10);return a}function W(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function X(a,b,c){var d=hb(Math.abs(a)/1e3),e=hb(d/60),f=hb(e/60),g=hb(f/24),h=hb(g/365),i=45>d&&["s",d]||1===e&&["m"]||45>e&&["mm",e]||1===f&&["h"]||22>f&&["hh",f]||1===g&&["d"]||25>=g&&["dd",g]||45>=g&&["M"]||345>g&&["MM",hb(g/30)]||1===h&&["y"]||["yy",h];return i[2]=b,i[3]=a>0,i[4]=c,W.apply({},i)}function Y(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=db(a).add("d",f),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function Z(a,b,c,d,e){var f,g,h=U(a,0,1).getUTCDay();return c=null!=c?c:e,f=e-h+(h>d?7:0)-(e>h?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:u(a-1)+g}}function $(a){var b=a._i,c=a._f;return null===b?db.invalid({nullInput:!0}):("string"==typeof b&&(a._i=b=C().preparse(b)),db.isMoment(b)?(a=i(b),a._d=new Date(+b._d)):c?m(c)?Q(a):N(a):S(a),new f(a))}function _(a,b){db.fn[a]=db.fn[a+"s"]=function(a){var c=this._isUTC?"UTC":"";return null!=a?(this._d["set"+c+b](a),db.updateOffset(this),this):this._d["get"+c+b]()}}function ab(a){db.duration.fn[a]=function(){return this._data[a]}}function bb(a,b){db.duration.fn["as"+a]=function(){return+this/b}}function cb(a){var b=!1,c=db;"undefined"==typeof ender&&(a?(gb.moment=function(){return!b&&console&&console.warn&&(b=!0,console.warn("Accessing Moment through the global scope is deprecated, and will be removed in an upcoming release.")),c.apply(null,arguments)},h(gb.moment,c)):gb.moment=db)}for(var db,eb,fb="2.5.1",gb=this,hb=Math.round,ib=0,jb=1,kb=2,lb=3,mb=4,nb=5,ob=6,pb={},qb={_isAMomentObject:null,_i:null,_f:null,_l:null,_strict:null,_isUTC:null,_offset:null,_pf:null,_lang:null},rb="undefined"!=typeof module&&module.exports&&"undefined"!=typeof require,sb=/^\/?Date\((\-?\d+)/i,tb=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,ub=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,vb=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,wb=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,xb=/\d\d?/,yb=/\d{1,3}/,zb=/\d{1,4}/,Ab=/[+\-]?\d{1,6}/,Bb=/\d+/,Cb=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Db=/Z|[\+\-]\d\d:?\d\d/gi,Eb=/T/i,Fb=/[\+\-]?\d+(\.\d{1,3})?/,Gb=/\d/,Hb=/\d\d/,Ib=/\d{3}/,Jb=/\d{4}/,Kb=/[+-]?\d{6}/,Lb=/[+-]?\d+/,Mb=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Nb="YYYY-MM-DDTHH:mm:ssZ",Ob=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],Pb=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],Qb=/([\+\-]|\d\d)/gi,Rb="Date|Hours|Minutes|Seconds|Milliseconds".split("|"),Sb={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},Tb={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},Ub={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},Vb={},Wb="DDD w W M D d".split(" "),Xb="M D H h m s w W".split(" "),Yb={M:function(){return this.month()+1},MMM:function(a){return this.lang().monthsShort(this,a)},MMMM:function(a){return this.lang().months(this,a)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(a){return this.lang().weekdaysMin(this,a)},ddd:function(a){return this.lang().weekdaysShort(this,a)},dddd:function(a){return this.lang().weekdays(this,a)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return k(this.year()%100,2)},YYYY:function(){return k(this.year(),4)},YYYYY:function(){return k(this.year(),5)},YYYYYY:function(){var a=this.year(),b=a>=0?"+":"-";return b+k(Math.abs(a),6)},gg:function(){return k(this.weekYear()%100,2)},gggg:function(){return k(this.weekYear(),4)},ggggg:function(){return k(this.weekYear(),5)},GG:function(){return k(this.isoWeekYear()%100,2)},GGGG:function(){return k(this.isoWeekYear(),4)},GGGGG:function(){return k(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return s(this.milliseconds()/100)},SS:function(){return k(s(this.milliseconds()/10),2)},SSS:function(){return k(this.milliseconds(),3)},SSSS:function(){return k(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+k(s(a/60),2)+":"+k(s(a)%60,2)},ZZ:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+k(s(a/60),2)+k(s(a)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},Zb=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];Wb.length;)eb=Wb.pop(),Yb[eb+"o"]=d(Yb[eb],eb);for(;Xb.length;)eb=Xb.pop(),Yb[eb+eb]=c(Yb[eb],2);for(Yb.DDDD=c(Yb.DDD,3),h(e.prototype,{set:function(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(a){return this._months[a.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a){var b,c,d;for(this._monthsParse||(this._monthsParse=[]),b=0;12>b;b++)if(this._monthsParse[b]||(c=db.utc([2e3,b]),d="^"+this.months(c,"")+"|^"+this.monthsShort(c,""),this._monthsParse[b]=new RegExp(d.replace(".",""),"i")),this._monthsParse[b].test(a))return b},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var b,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7>b;b++)if(this._weekdaysParse[b]||(c=db([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b){var c=this._calendar[a];return"function"==typeof c?c.apply(b):c},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",preparse:function(a){return a},postformat:function(a){return a},week:function(a){return Y(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),db=function(c,d,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._i=c,g._f=d,g._l=e,g._strict=f,g._isUTC=!1,g._pf=b(),$(g)},db.utc=function(c,d,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._useUTC=!0,g._isUTC=!0,g._l=e,g._i=c,g._f=d,g._strict=f,g._pf=b(),$(g).utc()},db.unix=function(a){return db(1e3*a)},db.duration=function(a,b){var c,d,e,f=a,h=null;return db.isDuration(a)?f={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(f={},b?f[b]=a:f.milliseconds=a):(h=tb.exec(a))?(c="-"===h[1]?-1:1,f={y:0,d:s(h[kb])*c,h:s(h[lb])*c,m:s(h[mb])*c,s:s(h[nb])*c,ms:s(h[ob])*c}):(h=ub.exec(a))&&(c="-"===h[1]?-1:1,e=function(a){var b=a&&parseFloat(a.replace(",","."));return(isNaN(b)?0:b)*c},f={y:e(h[2]),M:e(h[3]),d:e(h[4]),h:e(h[5]),m:e(h[6]),s:e(h[7]),w:e(h[8])}),d=new g(f),db.isDuration(a)&&a.hasOwnProperty("_lang")&&(d._lang=a._lang),d},db.version=fb,db.defaultFormat=Nb,db.updateOffset=function(){},db.lang=function(a,b){var c;return a?(b?A(y(a),b):null===b?(B(a),a="en"):pb[a]||C(a),c=db.duration.fn._lang=db.fn._lang=C(a),c._abbr):db.fn._lang._abbr},db.langData=function(a){return a&&a._lang&&a._lang._abbr&&(a=a._lang._abbr),C(a)},db.isMoment=function(a){return a instanceof f||null!=a&&a.hasOwnProperty("_isAMomentObject")},db.isDuration=function(a){return a instanceof g},eb=Zb.length-1;eb>=0;--eb)r(Zb[eb]);for(db.normalizeUnits=function(a){return p(a)},db.invalid=function(a){var b=db.utc(0/0);return null!=a?h(b._pf,a):b._pf.userInvalidated=!0,b},db.parseZone=function(a){return db(a).parseZone()},h(db.fn=f.prototype,{clone:function(){return db(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().lang("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var a=db(this).utc();return 0<a.year()&&a.year()<=9999?F(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):F(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var a=this;return[a.year(),a.month(),a.date(),a.hours(),a.minutes(),a.seconds(),a.milliseconds()]},isValid:function(){return x(this)},isDSTShifted:function(){return this._a?this.isValid()&&o(this._a,(this._isUTC?db.utc(this._a):db(this._a)).toArray())>0:!1},parsingFlags:function(){return h({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(a){var b=F(this,a||db.defaultFormat);return this.lang().postformat(b)},add:function(a,b){var c;return c="string"==typeof a?db.duration(+b,a):db.duration(a,b),l(this,c,1),this},subtract:function(a,b){var c;return c="string"==typeof a?db.duration(+b,a):db.duration(a,b),l(this,c,-1),this},diff:function(a,b,c){var d,e,f=z(a,this),g=6e4*(this.zone()-f.zone());return b=p(b),"year"===b||"month"===b?(d=432e5*(this.daysInMonth()+f.daysInMonth()),e=12*(this.year()-f.year())+(this.month()-f.month()),e+=(this-db(this).startOf("month")-(f-db(f).startOf("month")))/d,e-=6e4*(this.zone()-db(this).startOf("month").zone()-(f.zone()-db(f).startOf("month").zone()))/d,"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:j(e)},from:function(a,b){return db.duration(this.diff(a)).lang(this.lang()._abbr).humanize(!b)},fromNow:function(a){return this.from(db(),a)},calendar:function(){var a=z(db(),this).startOf("day"),b=this.diff(a,"days",!0),c=-6>b?"sameElse":-1>b?"lastWeek":0>b?"lastDay":1>b?"sameDay":2>b?"nextDay":7>b?"nextWeek":"sameElse";return this.format(this.lang().calendar(c,this))},isLeapYear:function(){return v(this.year())},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=V(a,this.lang()),this.add({d:a-b})):b},month:function(a){var b,c=this._isUTC?"UTC":"";return null!=a?"string"==typeof a&&(a=this.lang().monthsParse(a),"number"!=typeof a)?this:(b=this.date(),this.date(1),this._d["set"+c+"Month"](a),this.date(Math.min(b,this.daysInMonth())),db.updateOffset(this),this):this._d["get"+c+"Month"]()},startOf:function(a){switch(a=p(a)){case"year":this.month(0);case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a?this.weekday(0):"isoWeek"===a&&this.isoWeekday(1),this},endOf:function(a){return a=p(a),this.startOf(a).add("isoWeek"===a?"week":a,1).subtract("ms",1)},isAfter:function(a,b){return b="undefined"!=typeof b?b:"millisecond",+this.clone().startOf(b)>+db(a).startOf(b)},isBefore:function(a,b){return b="undefined"!=typeof b?b:"millisecond",+this.clone().startOf(b)<+db(a).startOf(b)},isSame:function(a,b){return b=b||"ms",+this.clone().startOf(b)===+z(a,this).startOf(b)},min:function(a){return a=db.apply(null,arguments),this>a?this:a},max:function(a){return a=db.apply(null,arguments),a>this?this:a},zone:function(a){var b=this._offset||0;return null==a?this._isUTC?b:this._d.getTimezoneOffset():("string"==typeof a&&(a=I(a)),Math.abs(a)<16&&(a=60*a),this._offset=a,this._isUTC=!0,b!==a&&l(this,db.duration(b-a,"m"),1,!0),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.zone(this._tzm):"string"==typeof this._i&&this.zone(this._i),this},hasAlignedHourOffset:function(a){return a=a?db(a).zone():0,(this.zone()-a)%60===0},daysInMonth:function(){return t(this.year(),this.month())},dayOfYear:function(a){var b=hb((db(this).startOf("day")-db(this).startOf("year"))/864e5)+1;return null==a?b:this.add("d",a-b)},quarter:function(){return Math.ceil((this.month()+1)/3)},weekYear:function(a){var b=Y(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==a?b:this.add("y",a-b)},isoWeekYear:function(a){var b=Y(this,1,4).year;return null==a?b:this.add("y",a-b)},week:function(a){var b=this.lang().week(this);return null==a?b:this.add("d",7*(a-b))},isoWeek:function(a){var b=Y(this,1,4).week;return null==a?b:this.add("d",7*(a-b))},weekday:function(a){var b=(this.day()+7-this.lang()._week.dow)%7;return null==a?b:this.add("d",a-b)},isoWeekday:function(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)},get:function(a){return a=p(a),this[a]()},set:function(a,b){return a=p(a),"function"==typeof this[a]&&this[a](b),this},lang:function(b){return b===a?this._lang:(this._lang=C(b),this)}}),eb=0;eb<Rb.length;eb++)_(Rb[eb].toLowerCase().replace(/s$/,""),Rb[eb]);_("year","FullYear"),db.fn.days=db.fn.day,db.fn.months=db.fn.month,db.fn.weeks=db.fn.week,db.fn.isoWeeks=db.fn.isoWeek,db.fn.toJSON=db.fn.toISOString,h(db.duration.fn=g.prototype,{_bubble:function(){var a,b,c,d,e=this._milliseconds,f=this._days,g=this._months,h=this._data;h.milliseconds=e%1e3,a=j(e/1e3),h.seconds=a%60,b=j(a/60),h.minutes=b%60,c=j(b/60),h.hours=c%24,f+=j(c/24),h.days=f%30,g+=j(f/30),h.months=g%12,d=j(g/12),h.years=d},weeks:function(){return j(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*s(this._months/12)},humanize:function(a){var b=+this,c=X(b,!a,this.lang());return a&&(c=this.lang().pastFuture(b,c)),this.lang().postformat(c)},add:function(a,b){var c=db.duration(a,b);return this._milliseconds+=c._milliseconds,this._days+=c._days,this._months+=c._months,this._bubble(),this},subtract:function(a,b){var c=db.duration(a,b);return this._milliseconds-=c._milliseconds,this._days-=c._days,this._months-=c._months,this._bubble(),this},get:function(a){return a=p(a),this[a.toLowerCase()+"s"]()},as:function(a){return a=p(a),this["as"+a.charAt(0).toUpperCase()+a.slice(1)+"s"]()},lang:db.fn.lang,toIsoString:function(){var a=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),f=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"}});for(eb in Sb)Sb.hasOwnProperty(eb)&&(bb(eb,Sb[eb]),ab(eb.toLowerCase()));bb("Weeks",6048e5),db.duration.fn.asMonths=function(){return(+this-31536e6*this.years())/2592e6+12*this.years()},db.lang("en",{ordinal:function(a){var b=a%10,c=1===s(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),rb?(module.exports=db,cb(!0)):"function"==typeof define&&define.amd?define("moment",function(b,c,d){return d.config&&d.config()&&d.config().noGlobal!==!0&&cb(d.config().noGlobal===a),db}):cb()}).call(this);
\ No newline at end of file
--- /dev/null
+@charset "UTF-8";
+
+/*!
+ * Pikaday
+ * Copyright © 2014 David Bushell | BSD & MIT license | http://dbushell.com/
+ */
+
+.pika-single {
+ z-index: 9999;
+ display: block;
+ position: relative;
+ width: 240px;
+ padding: 8px;
+ color: #333;
+ background: #fff;
+ border: 1px solid #ccc;
+ border-bottom-color: #bbb;
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+}
+
+.pika-single.is-hidden {
+ display: none;
+}
+
+.pika-single.is-bound {
+ position: absolute;
+ box-shadow: 0 5px 15px -5px rgba(0,0,0,.5);
+}
+
+.pika-title {
+ position: relative;
+ text-align: center;
+}
+
+.pika-label {
+ display: inline-block;
+ *display: inline;
+ position: relative;
+ z-index: 9999;
+ overflow: hidden;
+ margin: 0;
+ padding: 5px 3px;
+ font-size: 14px;
+ line-height: 20px;
+ font-weight: bold;
+ background-color: #fff;
+}
+.pika-title select {
+ cursor: pointer;
+ position: absolute;
+ z-index: 9998;
+ margin: 0;
+ left: 0;
+ top: 5px;
+ filter: alpha(opacity=0);
+ opacity: 0;
+}
+
+.pika-prev,
+.pika-next {
+ display: block;
+ cursor: pointer;
+ position: relative;
+ outline: none;
+ border: 0;
+ padding: 0;
+ width: 20px;
+ height: 30px;
+ /* hide text using text-indent trick, using width value (it's enough) */
+ text-indent: 20px;
+ white-space: nowrap;
+ overflow: hidden;
+ background-color: transparent;
+ background-position: center center;
+ background-repeat: no-repeat;
+ background-size: 75% 75%;
+ opacity: .5;
+ *position: absolute;
+ *top: 0;
+}
+
+.pika-prev:hover,
+.pika-next:hover {
+ opacity: 1;
+}
+
+.pika-prev,
+.is-rtl .pika-next {
+ float: left;
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAAUklEQVR42u3VMQoAIBADQf8Pgj+OD9hG2CtONJB2ymQkKe0HbwAP0xucDiQWARITIDEBEnMgMQ8S8+AqBIl6kKgHiXqQqAeJepBo/z38J/U0uAHlaBkBl9I4GwAAAABJRU5ErkJggg==');
+ *left: 0;
+}
+
+.pika-next,
+.is-rtl .pika-prev {
+ float: right;
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAAU0lEQVR42u3VOwoAMAgE0dwfAnNjU26bYkBCFGwfiL9VVWoO+BJ4Gf3gtsEKKoFBNTCoCAYVwaAiGNQGMUHMkjGbgjk2mIONuXo0nC8XnCf1JXgArVIZAQh5TKYAAAAASUVORK5CYII=');
+ *right: 0;
+}
+
+.pika-prev.is-disabled,
+.pika-next.is-disabled {
+ cursor: default;
+ opacity: .2;
+}
+
+.pika-select {
+ display: inline-block;
+ *display: inline;
+}
+
+.pika-table {
+ width: 100%;
+ border-collapse: collapse;
+ border-spacing: 0;
+ border: 0;
+}
+
+.pika-table th,
+.pika-table td {
+ width: 14.285714285714286%;
+ padding: 0;
+}
+
+.pika-table th {
+ color: #999;
+ font-size: 12px;
+ line-height: 25px;
+ font-weight: bold;
+ text-align: center;
+}
+
+.pika-button {
+ cursor: pointer;
+ display: block;
+ outline: none;
+ border: 0;
+ margin: 0;
+ width: 100%;
+ padding: 5px;
+ color: #666;
+ font-size: 12px;
+ line-height: 15px;
+ text-align: right;
+ background: #f5f5f5;
+}
+
+.is-today .pika-button {
+ color: #33aaff;
+ font-weight: bold;
+}
+
+.is-selected .pika-button {
+ color: #fff;
+ font-weight: bold;
+ background: #33aaff;
+ box-shadow: inset 0 1px 3px #178fe5;
+ border-radius: 3px;
+}
+
+.is-disabled .pika-button {
+ pointer-events: none;
+ cursor: default;
+ color: #999;
+ opacity: .3;
+}
+
+.pika-button:hover {
+ color: #fff !important;
+ background: #ff8000 !important;
+ box-shadow: none !important;
+ border-radius: 3px !important;
+}
--- /dev/null
+/*!
+ * Pikaday
+ *
+ * Copyright © 2014 David Bushell | BSD & MIT license | https://github.com/dbushell/Pikaday
+ */
+
+(function (root, factory)
+{
+ 'use strict';
+
+ var moment;
+ if (typeof exports === 'object') {
+ // CommonJS module
+ // Load moment.js as an optional dependency
+ try { moment = require('moment'); } catch (e) {}
+ module.exports = factory(moment);
+ } else if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(function (req)
+ {
+ // Load moment.js as an optional dependency
+ var id = 'moment';
+ moment = req.defined && req.defined(id) ? req(id) : undefined;
+ return factory(moment);
+ });
+ } else {
+ root.Pikaday = factory(root.moment);
+ }
+}(this, function (moment)
+{
+ 'use strict';
+
+ /**
+ * feature detection and helper functions
+ */
+ var hasMoment = typeof moment === 'function',
+
+ hasEventListeners = !!window.addEventListener,
+
+ document = window.document,
+
+ sto = window.setTimeout,
+
+ addEvent = function(el, e, callback, capture)
+ {
+ if (hasEventListeners) {
+ el.addEventListener(e, callback, !!capture);
+ } else {
+ el.attachEvent('on' + e, callback);
+ }
+ },
+
+ removeEvent = function(el, e, callback, capture)
+ {
+ if (hasEventListeners) {
+ el.removeEventListener(e, callback, !!capture);
+ } else {
+ el.detachEvent('on' + e, callback);
+ }
+ },
+
+ fireEvent = function(el, eventName, data)
+ {
+ var ev;
+
+ if (document.createEvent) {
+ ev = document.createEvent('HTMLEvents');
+ ev.initEvent(eventName, true, false);
+ ev = extend(ev, data);
+ el.dispatchEvent(ev);
+ } else if (document.createEventObject) {
+ ev = document.createEventObject();
+ ev = extend(ev, data);
+ el.fireEvent('on' + eventName, ev);
+ }
+ },
+
+ trim = function(str)
+ {
+ return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g,'');
+ },
+
+ hasClass = function(el, cn)
+ {
+ return (' ' + el.className + ' ').indexOf(' ' + cn + ' ') !== -1;
+ },
+
+ addClass = function(el, cn)
+ {
+ if (!hasClass(el, cn)) {
+ el.className = (el.className === '') ? cn : el.className + ' ' + cn;
+ }
+ },
+
+ removeClass = function(el, cn)
+ {
+ el.className = trim((' ' + el.className + ' ').replace(' ' + cn + ' ', ' '));
+ },
+
+ isArray = function(obj)
+ {
+ return (/Array/).test(Object.prototype.toString.call(obj));
+ },
+
+ isDate = function(obj)
+ {
+ return (/Date/).test(Object.prototype.toString.call(obj)) && !isNaN(obj.getTime());
+ },
+
+ isLeapYear = function(year)
+ {
+ // solution by Matti Virkkunen: http://stackoverflow.com/a/4881951
+ return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
+ },
+
+ getDaysInMonth = function(year, month)
+ {
+ return [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
+ },
+
+ setToStartOfDay = function(date)
+ {
+ if (isDate(date)) date.setHours(0,0,0,0);
+ },
+
+ compareDates = function(a,b)
+ {
+ // weak date comparison (use setToStartOfDay(date) to ensure correct result)
+ return a.getTime() === b.getTime();
+ },
+
+ extend = function(to, from, overwrite)
+ {
+ var prop, hasProp;
+ for (prop in from) {
+ hasProp = to[prop] !== undefined;
+ if (hasProp && typeof from[prop] === 'object' && from[prop].nodeName === undefined) {
+ if (isDate(from[prop])) {
+ if (overwrite) {
+ to[prop] = new Date(from[prop].getTime());
+ }
+ }
+ else if (isArray(from[prop])) {
+ if (overwrite) {
+ to[prop] = from[prop].slice(0);
+ }
+ } else {
+ to[prop] = extend({}, from[prop], overwrite);
+ }
+ } else if (overwrite || !hasProp) {
+ to[prop] = from[prop];
+ }
+ }
+ return to;
+ },
+
+
+ /**
+ * defaults and localisation
+ */
+ defaults = {
+
+ // bind the picker to a form field
+ field: null,
+
+ // automatically show/hide the picker on `field` focus (default `true` if `field` is set)
+ bound: undefined,
+
+ // position of the datepicker, relative to the field (default to bottom & left)
+ // ('bottom' & 'left' keywords are not used, 'top' & 'right' are modifier on the bottom/left position)
+ position: 'bottom left',
+
+ // the default output format for `.toString()` and `field` value
+ format: 'YYYY-MM-DD',
+
+ // the initial date to view when first opened
+ defaultDate: null,
+
+ // make the `defaultDate` the initial selected value
+ setDefaultDate: false,
+
+ // first day of week (0: Sunday, 1: Monday etc)
+ firstDay: 0,
+
+ // the minimum/earliest date that can be selected
+ minDate: null,
+ // the maximum/latest date that can be selected
+ maxDate: null,
+
+ // number of years either side, or array of upper/lower range
+ yearRange: 10,
+
+ // used internally (don't config outside)
+ minYear: 0,
+ maxYear: 9999,
+ minMonth: undefined,
+ maxMonth: undefined,
+
+ isRTL: false,
+
+ // Additional text to append to the year in the calendar title
+ yearSuffix: '',
+
+ // Render the month after year in the calendar title
+ showMonthAfterYear: false,
+
+ // how many months are visible (not implemented yet)
+ numberOfMonths: 1,
+
+ // internationalization
+ i18n: {
+ previousMonth : 'Previous Month',
+ nextMonth : 'Next Month',
+ months : ['January','February','March','April','May','June','July','August','September','October','November','December'],
+ weekdays : ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
+ weekdaysShort : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
+ },
+
+ // callback function
+ onSelect: null,
+ onOpen: null,
+ onClose: null,
+ onDraw: null
+ },
+
+
+ /**
+ * templating functions to abstract HTML rendering
+ */
+ renderDayName = function(opts, day, abbr)
+ {
+ day += opts.firstDay;
+ while (day >= 7) {
+ day -= 7;
+ }
+ return abbr ? opts.i18n.weekdaysShort[day] : opts.i18n.weekdays[day];
+ },
+
+ renderDay = function(i, isSelected, isToday, isDisabled, isEmpty)
+ {
+ if (isEmpty) {
+ return '<td class="is-empty"></td>';
+ }
+ var arr = [];
+ if (isDisabled) {
+ arr.push('is-disabled');
+ }
+ if (isToday) {
+ arr.push('is-today');
+ }
+ if (isSelected) {
+ arr.push('is-selected');
+ }
+ return '<td data-day="' + i + '" class="' + arr.join(' ') + '"><button class="pika-button" type="button">' + i + '</button>' + '</td>';
+ },
+
+ renderRow = function(days, isRTL)
+ {
+ return '<tr>' + (isRTL ? days.reverse() : days).join('') + '</tr>';
+ },
+
+ renderBody = function(rows)
+ {
+ return '<tbody>' + rows.join('') + '</tbody>';
+ },
+
+ renderHead = function(opts)
+ {
+ var i, arr = [];
+ for (i = 0; i < 7; i++) {
+ arr.push('<th scope="col"><abbr title="' + renderDayName(opts, i) + '">' + renderDayName(opts, i, true) + '</abbr></th>');
+ }
+ return '<thead>' + (opts.isRTL ? arr.reverse() : arr).join('') + '</thead>';
+ },
+
+ renderTitle = function(instance)
+ {
+ var i, j, arr,
+ opts = instance._o,
+ month = instance._m,
+ year = instance._y,
+ isMinYear = year === opts.minYear,
+ isMaxYear = year === opts.maxYear,
+ html = '<div class="pika-title">',
+ monthHtml,
+ yearHtml,
+ prev = true,
+ next = true;
+
+ for (arr = [], i = 0; i < 12; i++) {
+ arr.push('<option value="' + i + '"' +
+ (i === month ? ' selected': '') +
+ ((isMinYear && i < opts.minMonth) || (isMaxYear && i > opts.maxMonth) ? 'disabled' : '') + '>' +
+ opts.i18n.months[i] + '</option>');
+ }
+ monthHtml = '<div class="pika-label">' + opts.i18n.months[month] + '<select class="pika-select pika-select-month">' + arr.join('') + '</select></div>';
+
+ if (isArray(opts.yearRange)) {
+ i = opts.yearRange[0];
+ j = opts.yearRange[1] + 1;
+ } else {
+ i = year - opts.yearRange;
+ j = 1 + year + opts.yearRange;
+ }
+
+ for (arr = []; i < j && i <= opts.maxYear; i++) {
+ if (i >= opts.minYear) {
+ arr.push('<option value="' + i + '"' + (i === year ? ' selected': '') + '>' + (i) + '</option>');
+ }
+ }
+ yearHtml = '<div class="pika-label">' + year + opts.yearSuffix + '<select class="pika-select pika-select-year">' + arr.join('') + '</select></div>';
+
+ if (opts.showMonthAfterYear) {
+ html += yearHtml + monthHtml;
+ } else {
+ html += monthHtml + yearHtml;
+ }
+
+ if (isMinYear && (month === 0 || opts.minMonth >= month)) {
+ prev = false;
+ }
+
+ if (isMaxYear && (month === 11 || opts.maxMonth <= month)) {
+ next = false;
+ }
+
+ html += '<button class="pika-prev' + (prev ? '' : ' is-disabled') + '" type="button">' + opts.i18n.previousMonth + '</button>';
+ html += '<button class="pika-next' + (next ? '' : ' is-disabled') + '" type="button">' + opts.i18n.nextMonth + '</button>';
+
+ return html += '</div>';
+ },
+
+ renderTable = function(opts, data)
+ {
+ return '<table cellpadding="0" cellspacing="0" class="pika-table">' + renderHead(opts) + renderBody(data) + '</table>';
+ },
+
+
+ /**
+ * Pikaday constructor
+ */
+ Pikaday = function(options)
+ {
+ var self = this,
+ opts = self.config(options);
+
+ self._onMouseDown = function(e)
+ {
+ if (!self._v) {
+ return;
+ }
+ e = e || window.event;
+ var target = e.target || e.srcElement;
+ if (!target) {
+ return;
+ }
+
+ if (!hasClass(target, 'is-disabled')) {
+ if (hasClass(target, 'pika-button') && !hasClass(target, 'is-empty')) {
+ self.setDate(new Date(self._y, self._m, parseInt(target.innerHTML, 10)));
+ if (opts.bound) {
+ sto(function() {
+ self.hide();
+ }, 100);
+ }
+ return;
+ }
+ else if (hasClass(target, 'pika-prev')) {
+ self.prevMonth();
+ }
+ else if (hasClass(target, 'pika-next')) {
+ self.nextMonth();
+ }
+ }
+ if (!hasClass(target, 'pika-select')) {
+ if (e.preventDefault) {
+ e.preventDefault();
+ } else {
+ e.returnValue = false;
+ return false;
+ }
+ } else {
+ self._c = true;
+ }
+ };
+
+ self._onChange = function(e)
+ {
+ e = e || window.event;
+ var target = e.target || e.srcElement;
+ if (!target) {
+ return;
+ }
+ if (hasClass(target, 'pika-select-month')) {
+ self.gotoMonth(target.value);
+ }
+ else if (hasClass(target, 'pika-select-year')) {
+ self.gotoYear(target.value);
+ }
+ };
+
+ self._onInputChange = function(e)
+ {
+ var date;
+
+ if (e.firedBy === self) {
+ return;
+ }
+ if (hasMoment) {
+ date = moment(opts.field.value, opts.format);
+ date = (date && date.isValid()) ? date.toDate() : null;
+ }
+ else {
+ date = new Date(Date.parse(opts.field.value));
+ }
+ self.setDate(isDate(date) ? date : null);
+ if (!self._v) {
+ self.show();
+ }
+ };
+
+ self._onInputFocus = function()
+ {
+ self.show();
+ };
+
+ self._onInputClick = function()
+ {
+ self.show();
+ };
+
+ self._onInputBlur = function()
+ {
+ if (!self._c) {
+ self._b = sto(function() {
+ self.hide();
+ }, 50);
+ }
+ self._c = false;
+ };
+
+ self._onClick = function(e)
+ {
+ e = e || window.event;
+ var target = e.target || e.srcElement,
+ pEl = target;
+ if (!target) {
+ return;
+ }
+ if (!hasEventListeners && hasClass(target, 'pika-select')) {
+ if (!target.onchange) {
+ target.setAttribute('onchange', 'return;');
+ addEvent(target, 'change', self._onChange);
+ }
+ }
+ do {
+ if (hasClass(pEl, 'pika-single')) {
+ return;
+ }
+ }
+ while ((pEl = pEl.parentNode));
+ if (self._v && target !== opts.trigger) {
+ self.hide();
+ }
+ };
+
+ self.el = document.createElement('div');
+ self.el.className = 'pika-single' + (opts.isRTL ? ' is-rtl' : '');
+
+ addEvent(self.el, 'mousedown', self._onMouseDown, true);
+ addEvent(self.el, 'change', self._onChange);
+
+ if (opts.field) {
+ if (opts.bound) {
+ document.body.appendChild(self.el);
+ } else {
+ opts.field.parentNode.insertBefore(self.el, opts.field.nextSibling);
+ }
+ addEvent(opts.field, 'change', self._onInputChange);
+
+ if (!opts.defaultDate) {
+ if (hasMoment && opts.field.value) {
+ opts.defaultDate = moment(opts.field.value, opts.format).toDate();
+ } else {
+ opts.defaultDate = new Date(Date.parse(opts.field.value));
+ }
+ opts.setDefaultDate = true;
+ }
+ }
+
+ var defDate = opts.defaultDate;
+
+ if (isDate(defDate)) {
+ if (opts.setDefaultDate) {
+ self.setDate(defDate, true);
+ } else {
+ self.gotoDate(defDate);
+ }
+ } else {
+ self.gotoDate(new Date());
+ }
+
+ if (opts.bound) {
+ this.hide();
+ self.el.className += ' is-bound';
+ addEvent(opts.trigger, 'click', self._onInputClick);
+ addEvent(opts.trigger, 'focus', self._onInputFocus);
+ addEvent(opts.trigger, 'blur', self._onInputBlur);
+ } else {
+ this.show();
+ }
+
+ };
+
+
+ /**
+ * public Pikaday API
+ */
+ Pikaday.prototype = {
+
+
+ /**
+ * configure functionality
+ */
+ config: function(options)
+ {
+ if (!this._o) {
+ this._o = extend({}, defaults, true);
+ }
+
+ var opts = extend(this._o, options, true);
+
+ opts.isRTL = !!opts.isRTL;
+
+ opts.field = (opts.field && opts.field.nodeName) ? opts.field : null;
+
+ opts.bound = !!(opts.bound !== undefined ? opts.field && opts.bound : opts.field);
+
+ opts.trigger = (opts.trigger && opts.trigger.nodeName) ? opts.trigger : opts.field;
+
+ var nom = parseInt(opts.numberOfMonths, 10) || 1;
+ opts.numberOfMonths = nom > 4 ? 4 : nom;
+
+ if (!isDate(opts.minDate)) {
+ opts.minDate = false;
+ }
+ if (!isDate(opts.maxDate)) {
+ opts.maxDate = false;
+ }
+ if ((opts.minDate && opts.maxDate) && opts.maxDate < opts.minDate) {
+ opts.maxDate = opts.minDate = false;
+ }
+ if (opts.minDate) {
+ setToStartOfDay(opts.minDate);
+ opts.minYear = opts.minDate.getFullYear();
+ opts.minMonth = opts.minDate.getMonth();
+ }
+ if (opts.maxDate) {
+ setToStartOfDay(opts.maxDate);
+ opts.maxYear = opts.maxDate.getFullYear();
+ opts.maxMonth = opts.maxDate.getMonth();
+ }
+
+ if (isArray(opts.yearRange)) {
+ var fallback = new Date().getFullYear() - 10;
+ opts.yearRange[0] = parseInt(opts.yearRange[0], 10) || fallback;
+ opts.yearRange[1] = parseInt(opts.yearRange[1], 10) || fallback;
+ } else {
+ opts.yearRange = Math.abs(parseInt(opts.yearRange, 10)) || defaults.yearRange;
+ if (opts.yearRange > 100) {
+ opts.yearRange = 100;
+ }
+ }
+
+ return opts;
+ },
+
+ /**
+ * return a formatted string of the current selection (using Moment.js if available)
+ */
+ toString: function(format)
+ {
+ return !isDate(this._d) ? '' : hasMoment ? moment(this._d).format(format || this._o.format) : this._d.toDateString();
+ },
+
+ /**
+ * return a Moment.js object of the current selection (if available)
+ */
+ getMoment: function()
+ {
+ return hasMoment ? moment(this._d) : null;
+ },
+
+ /**
+ * set the current selection from a Moment.js object (if available)
+ */
+ setMoment: function(date, preventOnSelect)
+ {
+ if (hasMoment && moment.isMoment(date)) {
+ this.setDate(date.toDate(), preventOnSelect);
+ }
+ },
+
+ /**
+ * return a Date object of the current selection
+ */
+ getDate: function()
+ {
+ return isDate(this._d) ? new Date(this._d.getTime()) : null;
+ },
+
+ /**
+ * set the current selection
+ */
+ setDate: function(date, preventOnSelect)
+ {
+ if (!date) {
+ this._d = null;
+ return this.draw();
+ }
+ if (typeof date === 'string') {
+ date = new Date(Date.parse(date));
+ }
+ if (!isDate(date)) {
+ return;
+ }
+
+ var min = this._o.minDate,
+ max = this._o.maxDate;
+
+ if (isDate(min) && date < min) {
+ date = min;
+ } else if (isDate(max) && date > max) {
+ date = max;
+ }
+
+ this._d = new Date(date.getTime());
+ setToStartOfDay(this._d);
+ this.gotoDate(this._d);
+
+ if (this._o.field) {
+ this._o.field.value = this.toString();
+ fireEvent(this._o.field, 'change', { firedBy: this });
+ }
+ if (!preventOnSelect && typeof this._o.onSelect === 'function') {
+ this._o.onSelect.call(this, this.getDate());
+ }
+ },
+
+ /**
+ * change view to a specific date
+ */
+ gotoDate: function(date)
+ {
+ if (!isDate(date)) {
+ return;
+ }
+ this._y = date.getFullYear();
+ this._m = date.getMonth();
+ this.draw();
+ },
+
+ gotoToday: function()
+ {
+ this.gotoDate(new Date());
+ },
+
+ /**
+ * change view to a specific month (zero-index, e.g. 0: January)
+ */
+ gotoMonth: function(month)
+ {
+ if (!isNaN( (month = parseInt(month, 10)) )) {
+ this._m = month < 0 ? 0 : month > 11 ? 11 : month;
+ this.draw();
+ }
+ },
+
+ nextMonth: function()
+ {
+ if (++this._m > 11) {
+ this._m = 0;
+ this._y++;
+ }
+ this.draw();
+ },
+
+ prevMonth: function()
+ {
+ if (--this._m < 0) {
+ this._m = 11;
+ this._y--;
+ }
+ this.draw();
+ },
+
+ /**
+ * change view to a specific full year (e.g. "2012")
+ */
+ gotoYear: function(year)
+ {
+ if (!isNaN(year)) {
+ this._y = parseInt(year, 10);
+ this.draw();
+ }
+ },
+
+ /**
+ * change the minDate
+ */
+ setMinDate: function(value)
+ {
+ this._o.minDate = value;
+ },
+
+ /**
+ * change the maxDate
+ */
+ setMaxDate: function(value)
+ {
+ this._o.maxDate = value;
+ },
+
+ /**
+ * refresh the HTML
+ */
+ draw: function(force)
+ {
+ if (!this._v && !force) {
+ return;
+ }
+ var opts = this._o,
+ minYear = opts.minYear,
+ maxYear = opts.maxYear,
+ minMonth = opts.minMonth,
+ maxMonth = opts.maxMonth;
+
+ if (this._y <= minYear) {
+ this._y = minYear;
+ if (!isNaN(minMonth) && this._m < minMonth) {
+ this._m = minMonth;
+ }
+ }
+ if (this._y >= maxYear) {
+ this._y = maxYear;
+ if (!isNaN(maxMonth) && this._m > maxMonth) {
+ this._m = maxMonth;
+ }
+ }
+
+ this.el.innerHTML = renderTitle(this) + this.render(this._y, this._m);
+
+ if (opts.bound) {
+ this.adjustPosition();
+ if(opts.field.type !== 'hidden') {
+ sto(function() {
+ opts.trigger.focus();
+ }, 1);
+ }
+ }
+
+ if (typeof this._o.onDraw === 'function') {
+ var self = this;
+ sto(function() {
+ self._o.onDraw.call(self);
+ }, 0);
+ }
+ },
+
+ adjustPosition: function()
+ {
+ var field = this._o.trigger, pEl = field,
+ width = this.el.offsetWidth, height = this.el.offsetHeight,
+ viewportWidth = window.innerWidth || document.documentElement.clientWidth,
+ viewportHeight = window.innerHeight || document.documentElement.clientHeight,
+ scrollTop = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop,
+ left, top, clientRect;
+
+ if (typeof field.getBoundingClientRect === 'function') {
+ clientRect = field.getBoundingClientRect();
+ left = clientRect.left + window.pageXOffset;
+ top = clientRect.bottom + window.pageYOffset;
+ } else {
+ left = pEl.offsetLeft;
+ top = pEl.offsetTop + pEl.offsetHeight;
+ while((pEl = pEl.offsetParent)) {
+ left += pEl.offsetLeft;
+ top += pEl.offsetTop;
+ }
+ }
+
+ // default position is bottom & left
+ if (left + width > viewportWidth ||
+ (
+ this._o.position.indexOf('right') > -1 &&
+ left - width + field.offsetWidth > 0
+ )
+ ) {
+ left = left - width + field.offsetWidth;
+ }
+ if (top + height > viewportHeight + scrollTop ||
+ (
+ this._o.position.indexOf('top') > -1 &&
+ top - height - field.offsetHeight > 0
+ )
+ ) {
+ top = top - height - field.offsetHeight;
+ }
+ this.el.style.cssText = [
+ 'position: absolute',
+ 'left: ' + left + 'px',
+ 'top: ' + top + 'px'
+ ].join(';');
+ },
+
+ /**
+ * render HTML for a particular month
+ */
+ render: function(year, month)
+ {
+ var opts = this._o,
+ now = new Date(),
+ days = getDaysInMonth(year, month),
+ before = new Date(year, month, 1).getDay(),
+ data = [],
+ row = [];
+ setToStartOfDay(now);
+ if (opts.firstDay > 0) {
+ before -= opts.firstDay;
+ if (before < 0) {
+ before += 7;
+ }
+ }
+ var cells = days + before,
+ after = cells;
+ while(after > 7) {
+ after -= 7;
+ }
+ cells += 7 - after;
+ for (var i = 0, r = 0; i < cells; i++)
+ {
+ var day = new Date(year, month, 1 + (i - before)),
+ isDisabled = (opts.minDate && day < opts.minDate) || (opts.maxDate && day > opts.maxDate),
+ isSelected = isDate(this._d) ? compareDates(day, this._d) : false,
+ isToday = compareDates(day, now),
+ isEmpty = i < before || i >= (days + before);
+
+ row.push(renderDay(1 + (i - before), isSelected, isToday, isDisabled, isEmpty));
+
+ if (++r === 7) {
+ data.push(renderRow(row, opts.isRTL));
+ row = [];
+ r = 0;
+ }
+ }
+ return renderTable(opts, data);
+ },
+
+ isVisible: function()
+ {
+ return this._v;
+ },
+
+ show: function()
+ {
+ if (!this._v) {
+ if (this._o.bound) {
+ addEvent(document, 'click', this._onClick);
+ }
+ removeClass(this.el, 'is-hidden');
+ this._v = true;
+ this.draw();
+ if (typeof this._o.onOpen === 'function') {
+ this._o.onOpen.call(this);
+ }
+ }
+ },
+
+ hide: function()
+ {
+ var v = this._v;
+ if (v !== false) {
+ if (this._o.bound) {
+ removeEvent(document, 'click', this._onClick);
+ }
+ this.el.style.cssText = '';
+ addClass(this.el, 'is-hidden');
+ this._v = false;
+ if (v !== undefined && typeof this._o.onClose === 'function') {
+ this._o.onClose.call(this);
+ }
+ }
+ },
+
+ /**
+ * GAME OVER
+ */
+ destroy: function()
+ {
+ this.hide();
+ removeEvent(this.el, 'mousedown', this._onMouseDown, true);
+ removeEvent(this.el, 'change', this._onChange);
+ if (this._o.field) {
+ removeEvent(this._o.field, 'change', this._onInputChange);
+ if (this._o.bound) {
+ removeEvent(this._o.trigger, 'click', this._onInputClick);
+ removeEvent(this._o.trigger, 'focus', this._onInputFocus);
+ removeEvent(this._o.trigger, 'blur', this._onInputBlur);
+ }
+ }
+ if (this.el.parentNode) {
+ this.el.parentNode.removeChild(this.el);
+ }
+ }
+
+ };
+
+ return Pikaday;
+
+}));
+
+/*!
+ * Pikaday jQuery plugin.
+ *
+ * Copyright © 2013 David Bushell | BSD & MIT license | https://github.com/dbushell/Pikaday
+ */
+
+(function (root, factory)
+{
+ 'use strict';
+
+ if (typeof exports === 'object') {
+ // CommonJS module
+ factory(require('jquery'), require('../pikaday'));
+ } else if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(['jquery', 'pikaday'], factory);
+ } else {
+ // Browser globals
+ factory(root.jQuery, root.Pikaday);
+ }
+}(this, function ($, Pikaday)
+{
+ 'use strict';
+
+ $.fn.pikaday = function()
+ {
+ var args = arguments;
+
+ if (!args || !args.length) {
+ args = [{ }];
+ }
+
+ return this.each(function()
+ {
+ var self = $(this),
+ plugin = self.data('pikaday');
+
+ if (!(plugin instanceof Pikaday)) {
+ if (typeof args[0] === 'object') {
+ var options = $.extend({}, args[0]);
+ options.field = self[0];
+ self.data('pikaday', new Pikaday(options));
+ }
+ } else {
+ if (typeof args[0] === 'string' && typeof plugin[args[0]] === 'function') {
+ plugin[args[0]].apply(plugin, Array.prototype.slice.call(args,1));
+ }
+ }
+ });
+ };
+
+}));
--- /dev/null
+body {
+ background: #015;
+ color: #bbb;
+ font-family: helvetica, arial, sans-serif;
+ font-size: 15px;
+ line-height: 1.3;
+ margin: 0;
+ padding: 0;
+}
+
+header,
+section,
+footer {
+ padding: 20px;
+}
+
+header,
+footer {
+ background: #111;
+ color: #666;
+ position: relative;
+}
+
+header h1 {
+ margin: 0;
+ padding: 0;
+}
+
+header h1 a {
+ font-family: Lucida Sans Unicode, Lucida Grande, sans-serif;
+ font-size: 60px;
+ font-weight: 200;
+ text-decoration: none;
+}
+
+header p {
+ font-size: 23px;
+}
+
+#header-links {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+ position: absolute;
+ right: 20px;
+ top: 30px;
+ text-align: right;
+}
+
+#header-links a {
+ color: #888;
+}
+
+#header-links a:hover {
+ color: #06c;
+}
+
+h2 {
+ color: #eee;
+ font-size: 35px;
+ font-weight: normal;
+ margin: 0;
+ line-height: 1.1
+}
+
+p {
+ margin: 20px 0 0 0;
+}
+
+p:first-child {
+ margin-top: 0;
+}
+
+input {
+ font-size: 13px;
+ -webkit-border-radius: 3px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+ padding: 3px;
+ background: #dde;
+ border: 1px solid #aac;
+}
+
+input.time {
+ width: 80px;
+}
+
+input.date {
+ width: 90px;
+}
+
+a {
+ color: #06c;
+ text-decoration: none;
+}
+
+a:hover {
+ text-decoration: underline;
+}
+
+image {
+ border: 0;
+}
+
+#examples article {
+ padding-top: 100px;
+ clear: both;
+}
+
+#examples article:first-child {
+ padding-top: 0;
+}
+
+#examples .demo {
+ width: 450px;
+ float: left;
+}
+
+#examples .code {
+ font-size: 12px;
+ margin: 0 0 0 470px;
+}
+
+footer {
+ font-size: 12px;
+}
+
+div.ui-datepicker { font-size: 11px; }
+
+#alternateUiWidgetsExample .date { width: 120px; }
+
+/**
+ * Blackboard theme
+ *
+ * Adapted from Domenico Carbotta's TextMate theme of the same name
+ *
+ * @author Domenico Carbotta
+ * @author Craig Campbell
+ * @version 1.0.2
+ */
+pre {
+ background: #0B1022;
+ word-wrap: break-word;
+ margin: 0px;
+ padding: 0px;
+ padding: 10px;
+ color: #fff;
+ font-size: 12px;
+ margin: 0;
+ overflow-y: auto;
+ -webkit-border-radius: 8px;
+ -moz-border-radius: 8px;
+ border-radius: 8px;
+}
+
+pre, code {
+ font-family: Consolas, 'Monaco', courier, monospace;
+}
+
+pre .comment {
+ color: #727272;
+}
+
+pre .constant {
+ color: #D8FA3C;
+}
+
+pre .storage {
+ color: #FBDE2D;
+}
+
+pre .string, pre .comment.docstring {
+ color: #61CE3C;
+}
+
+pre .string.regexp, pre .support.tag.script, pre .support.tag.style {
+ color: #fff;
+}
+
+pre .keyword, pre .selector {
+ color: #FBDE2D;
+}
+
+pre .inherited-class {
+ font-style: italic;
+}
+
+pre .entity {
+ color: #FF6400;
+}
+
+pre .support, *[data-language="c"] .function.call {
+ color: #8DA6CE;
+}
+
+pre .variable.global, pre .variable.class, pre .variable.instance {
+ color: #FF6400;
+}
+
+
--- /dev/null
+/* Rainbow v1.1.8 rainbowco.de | included languages: generic, javascript */
+window.Rainbow=function(){function q(a){var b,c=a.getAttribute&&a.getAttribute("data-language")||0;if(!c){a=a.attributes;for(b=0;b<a.length;++b)if("data-language"===a[b].nodeName)return a[b].nodeValue}return c}function B(a){var b=q(a)||q(a.parentNode);if(!b){var c=/\blang(?:uage)?-(\w+)/;(a=a.className.match(c)||a.parentNode.className.match(c))&&(b=a[1])}return b}function C(a,b){for(var c in e[d]){c=parseInt(c,10);if(a==c&&b==e[d][c]?0:a<=c&&b>=e[d][c])delete e[d][c],delete j[d][c];if(a>=c&&a<e[d][c]||
+b>c&&b<e[d][c])return!0}return!1}function r(a,b){return'<span class="'+a.replace(/\./g," ")+(l?" "+l:"")+'">'+b+"</span>"}function s(a,b,c,h){var f=a.exec(c);if(f){++t;!b.name&&"string"==typeof b.matches[0]&&(b.name=b.matches[0],delete b.matches[0]);var k=f[0],i=f.index,u=f[0].length+i,g=function(){function f(){s(a,b,c,h)}t%100>0?f():setTimeout(f,0)};if(C(i,u))g();else{var m=v(b.matches),l=function(a,c,h){if(a>=c.length)h(k);else{var d=f[c[a]];if(d){var e=b.matches[c[a]],i=e.language,g=e.name&&e.matches?
+e.matches:e,j=function(b,d,e){var i;i=0;var g;for(g=1;g<c[a];++g)f[g]&&(i=i+f[g].length);d=e?r(e,d):d;k=k.substr(0,i)+k.substr(i).replace(b,d);l(++a,c,h)};i?n(d,i,function(a){j(d,a)}):typeof e==="string"?j(d,d,e):w(d,g.length?g:[g],function(a){j(d,a,e.matches?e.name:0)})}else l(++a,c,h)}};l(0,m,function(a){b.name&&(a=r(b.name,a));if(!j[d]){j[d]={};e[d]={}}j[d][i]={replace:f[0],"with":a};e[d][i]=u;g()})}}else h()}function v(a){var b=[],c;for(c in a)a.hasOwnProperty(c)&&b.push(c);return b.sort(function(a,
+b){return b-a})}function w(a,b,c){function h(b,k){k<b.length?s(b[k].pattern,b[k],a,function(){h(b,++k)}):D(a,function(a){delete j[d];delete e[d];--d;c(a)})}++d;h(b,0)}function D(a,b){function c(a,b,h,e){if(h<b.length){++x;var g=b[h],l=j[d][g],a=a.substr(0,g)+a.substr(g).replace(l.replace,l["with"]),g=function(){c(a,b,++h,e)};0<x%250?g():setTimeout(g,0)}else e(a)}var h=v(j[d]);c(a,h,0,b)}function n(a,b,c){var d=m[b]||[],f=m[y]||[],b=z[b]?d:d.concat(f);w(a.replace(/</g,"<").replace(/>/g,">").replace(/&(?![\w\#]+;)/g,
+"&"),b,c)}function o(a,b,c){if(b<a.length){var d=a[b],f=B(d);return!(-1<(" "+d.className+" ").indexOf(" rainbow "))&&f?(f=f.toLowerCase(),d.className+=d.className?" rainbow":"rainbow",n(d.innerHTML,f,function(k){d.innerHTML=k;j={};e={};p&&p(d,f);setTimeout(function(){o(a,++b,c)},0)})):o(a,++b,c)}c&&c()}function A(a,b){var a=a&&"function"==typeof a.getElementsByTagName?a:document,c=a.getElementsByTagName("pre"),d=a.getElementsByTagName("code"),f,e=[];for(f=0;f<d.length;++f)e.push(d[f]);for(f=0;f<
+c.length;++f)c[f].getElementsByTagName("code").length||e.push(c[f]);o(e,0,b)}var j={},e={},m={},z={},d=0,y=0,t=0,x=0,l,p;return{extend:function(a,b,c){1==arguments.length&&(b=a,a=y);z[a]=c;m[a]=b.concat(m[a]||[])},b:function(a){p=a},a:function(a){l=a},color:function(a,b,c){if("string"==typeof a)return n(a,b,c);if("function"==typeof a)return A(0,a);A(a,b)}}}();window.addEventListener?window.addEventListener("load",Rainbow.color,!1):window.attachEvent("onload",Rainbow.color);Rainbow.onHighlight=Rainbow.b;
+Rainbow.addClass=Rainbow.a;Rainbow.extend([{matches:{1:{name:"keyword.operator",pattern:/\=/g},2:{name:"string",matches:{name:"constant.character.escape",pattern:/\\('|"){1}/g}}},pattern:/(\(|\s|\[|\=|:)(('|")([^\\\1]|\\.)*?(\3))/gm},{name:"comment",pattern:/\/\*[\s\S]*?\*\/|(\/\/|\#)[\s\S]*?$/gm},{name:"constant.numeric",pattern:/\b(\d+(\.\d+)?(e(\+|\-)?\d+)?(f|d)?|0x[\da-f]+)\b/gi},{matches:{1:"keyword"},pattern:/\b(and|array|as|bool(ean)?|c(atch|har|lass|onst)|d(ef|elete|o(uble)?)|e(cho|lse(if)?|xit|xtends|xcept)|f(inally|loat|or(each)?|unction)|global|if|import|int(eger)?|long|new|object|or|pr(int|ivate|otected)|public|return|self|st(ring|ruct|atic)|switch|th(en|is|row)|try|(un)?signed|var|void|while)(?=\(|\b)/gi},
+{name:"constant.language",pattern:/true|false|null/g},{name:"keyword.operator",pattern:/\+|\!|\-|&(gt|lt|amp);|\||\*|\=/g},{matches:{1:"function.call"},pattern:/(\w+?)(?=\()/g},{matches:{1:"storage.function",2:"entity.name.function"},pattern:/(function)\s(.*?)(?=\()/g}]);Rainbow.extend("javascript",[{name:"selector",pattern:/(\s|^)\$(?=\.|\()/g},{name:"support",pattern:/\b(window|document)\b/g},{matches:{1:"support.property"},pattern:/\.(length|node(Name|Value))\b/g},{matches:{1:"support.function"},pattern:/(setTimeout|setInterval)(?=\()/g},{matches:{1:"support.method"},pattern:/\.(getAttribute|push|getElementById|getElementsByClassName|log|setTimeout|setInterval)(?=\()/g},{matches:{1:"support.tag.script",2:[{name:"string",pattern:/('|")(.*?)(\1)/g},{name:"entity.tag.script",
+pattern:/(\w+)/g}],3:"support.tag.script"},pattern:/(<\/?)(script.*?)(>)/g},{name:"string.regexp",matches:{1:"string.regexp.open",2:{name:"constant.regexp.escape",pattern:/\\(.){1}/g},3:"string.regexp.close",4:"string.regexp.modifier"},pattern:/(\/)(?!\*)(.+)(\/)([igm]{0,3})/g},{matches:{1:"storage",3:"entity.function"},pattern:/(var)?(\s|^)(.*)(?=\s?=\s?function\()/g},{name:"entity.function",pattern:/(\w+)(?=:\s{0,}function)/g}]);
--- /dev/null
+{
+ "name": "datepair.js",
+ "description": "A javascript plugin for intelligently selecting date and time ranges inspired by Google Calendar.",
+ "homepage": "http://jonthornton.github.com/Datepair.js",
+ "version": "0.4.14",
+ "main": "dist/datepair.js",
+ "author": {
+ "name": "Jon Thornton",
+ "url": "https://github.com/jonthornton"
+ },
+ "repository": {
+ "type" : "git",
+ "url" : "https://github.com/jonthornton/Datepair.js.git"
+ },
+ "license": "MIT",
+ "devDependencies": {
+ "grunt": "~0.4.1",
+ "grunt-contrib-uglify": "~0.4.0",
+ "grunt-rigger": "~0.5.0",
+ "grunt-contrib-jshint": "^0.11.3",
+ "grunt-contrib-watch": "~0.5.1"
+ },
+ "keywords": [ "timepicker", "datepicker", "time", "date", "picker", "ui", "calendar", "input", "form" ]
+}
--- /dev/null
+var _ONE_DAY = 86400000;
+var jq = window.Zepto || window.jQuery;
+
+function simpleExtend(obj1, obj2) {
+ var out = obj2 || {};
+
+ for (var i in obj1) {
+ if (!(i in out)) {
+ out[i] = obj1[i];
+ }
+ }
+
+ return out;
+}
+
+// IE's custom event support is totally borked.
+// Use jQuery if possible
+function triggerSimpleCustomEvent(el, eventName) {
+ if (jq) {
+ jq(el).trigger(eventName);
+ } else {
+ var event = document.createEvent('CustomEvent');
+ event.initCustomEvent(eventName, true, true, {});
+ el.dispatchEvent(event);
+ }
+}
+
+// el.classList not supported by < IE10
+// use jQuery if available
+function hasClass(el, className) {
+ if (jq) {
+ return jq(el).hasClass(className);
+ } else {
+ return el.classList.contains(className);
+ }
+}
+
+function Datepair(container, options) {
+ this.dateDelta = null;
+ this.timeDelta = null;
+ this._defaults = {
+ startClass: 'start',
+ endClass: 'end',
+ timeClass: 'time',
+ dateClass: 'date',
+ defaultDateDelta: 0,
+ defaultTimeDelta: 3600000,
+ anchor: 'start',
+
+ // defaults for jquery-timepicker; override when using other input widgets
+ parseTime: function(input){
+ return jq(input).timepicker('getTime');
+ },
+ updateTime: function(input, dateObj){
+ jq(input).timepicker('setTime', dateObj);
+ },
+ setMinTime: function(input, dateObj){
+ jq(input).timepicker('option', 'minTime', dateObj);
+ },
+
+ // defaults for bootstrap datepicker; override when using other input widgets
+ parseDate: function(input){
+ return input.value && jq(input).datepicker('getDate');
+ },
+ updateDate: function(input, dateObj){
+ jq(input).datepicker('update', dateObj);
+ }
+ };
+
+ this.container = container;
+ this.settings = simpleExtend(this._defaults, options);
+
+ this.startDateInput = this.container.querySelector('.'+this.settings.startClass+'.'+this.settings.dateClass);
+ this.endDateInput = this.container.querySelector('.'+this.settings.endClass+'.'+this.settings.dateClass);
+ this.startTimeInput = this.container.querySelector('.'+this.settings.startClass+'.'+this.settings.timeClass);
+ this.endTimeInput = this.container.querySelector('.'+this.settings.endClass+'.'+this.settings.timeClass);
+
+ // initialize date and time deltas
+ this.refresh();
+
+ // init starts here
+ this._bindChangeHandler();
+}
+
+Datepair.prototype = {
+ constructor: Datepair,
+
+ option: function(key, value)
+ {
+ if (typeof key == 'object') {
+ this.settings = simpleExtend(this.settings, key);
+
+ } else if (typeof key == 'string' && typeof value != 'undefined') {
+ this.settings[key] = value;
+
+ } else if (typeof key == 'string') {
+ return this.settings[key];
+ }
+
+ this._updateEndMintime();
+ },
+
+ getTimeDiff: function()
+ {
+ // due to the fact that times can wrap around, timeDiff for any
+ // time-only pair will always be >= 0
+ var delta = this.dateDelta + this.timeDelta;
+ if (delta < 0 && (!this.startDateInput || !this.endDateInput) ) {
+ delta += _ONE_DAY;
+ }
+
+ return delta;
+ },
+
+ refresh: function()
+ {
+ if (this.startDateInput && this.startDateInput.value && this.endDateInput && this.endDateInput.value) {
+ var startDate = this.settings.parseDate(this.startDateInput);
+ var endDate = this.settings.parseDate(this.endDateInput);
+ if (startDate && endDate) {
+ this.dateDelta = endDate.getTime() - startDate.getTime();
+ }
+ }
+ if (this.startTimeInput && this.startTimeInput.value && this.endTimeInput && this.endTimeInput.value) {
+ var startTime = this.settings.parseTime(this.startTimeInput);
+ var endTime = this.settings.parseTime(this.endTimeInput);
+ if (startTime && endTime) {
+ this.timeDelta = endTime.getTime() - startTime.getTime();
+ this._updateEndMintime();
+ }
+ }
+ },
+
+ remove: function()
+ {
+ this._unbindChangeHandler();
+ },
+
+ _bindChangeHandler: function(){
+ // addEventListener doesn't work with synthetic "change" events
+ // fired by jQuery's trigger() functioin. If jQuery is present,
+ // use that for event binding
+ if (jq) {
+ jq(this.container).on('change.datepair', jq.proxy(this.handleEvent, this));
+ } else {
+ this.container.addEventListener('change', this, false);
+ }
+ },
+
+ _unbindChangeHandler: function(){
+ if (jq) {
+ jq(this.container).off('change.datepair');
+ } else {
+ this.container.removeEventListener('change', this, false);
+ }
+ },
+
+ // This function will be called when passing 'this' to addEventListener
+ handleEvent: function(e){
+ // temporarily unbind the change handler to prevent triggering this
+ // if we update other inputs
+ this._unbindChangeHandler();
+
+ if (hasClass(e.target, this.settings.dateClass)) {
+ if (e.target.value != '') {
+ this._dateChanged(e.target);
+ this._timeChanged(e.target);
+ } else {
+ this.dateDelta = null;
+ }
+
+ } else if (hasClass(e.target, this.settings.timeClass)) {
+ if (e.target.value != '') {
+ this._timeChanged(e.target);
+ } else {
+ this.timeDelta = null;
+ }
+ }
+
+ this._validateRanges();
+ this._updateEndMintime();
+ this._bindChangeHandler();
+ },
+
+ _dateChanged: function(target){
+ if (!this.startDateInput || !this.endDateInput) {
+ return;
+ }
+
+ var startDate = this.settings.parseDate(this.startDateInput);
+ var endDate = this.settings.parseDate(this.endDateInput);
+
+ if (!startDate || !endDate) {
+ if (this.settings.defaultDateDelta !== null) {
+ if (startDate) {
+ var newEnd = new Date(startDate.getTime() + this.settings.defaultDateDelta * _ONE_DAY);
+ this.settings.updateDate(this.endDateInput, newEnd);
+
+ } else if (endDate) {
+ var newStart = new Date(endDate.getTime() - this.settings.defaultDateDelta * _ONE_DAY);
+ this.settings.updateDate(this.startDateInput, newStart);
+ }
+
+ this.dateDelta = this.settings.defaultDateDelta * _ONE_DAY;
+ } else {
+ this.dateDelta = null;
+ }
+
+ return;
+ }
+
+ if (this.settings.anchor == 'start' && hasClass(target, this.settings.startClass)) {
+ var newDate = new Date(startDate.getTime() + this.dateDelta);
+ this.settings.updateDate(this.endDateInput, newDate);
+ } else if (this.settings.anchor == 'end' && hasClass(target, this.settings.endClass)) {
+ var newDate = new Date(endDate.getTime() - this.dateDelta);
+ this.settings.updateDate(this.startDateInput, newDate);
+ } else {
+ if (endDate < startDate) {
+ var otherInput = hasClass(target, this.settings.startClass) ? this.endDateInput : this.startDateInput;
+ var selectedDate = this.settings.parseDate(target);
+ this.dateDelta = 0;
+ this.settings.updateDate(otherInput, selectedDate);
+ } else {
+ this.dateDelta = endDate.getTime() - startDate.getTime();
+ }
+ }
+ },
+
+ _timeChanged: function(target){
+ if (!this.startTimeInput || !this.endTimeInput) {
+ return;
+ }
+
+ var startTime = this.settings.parseTime(this.startTimeInput);
+ var endTime = this.settings.parseTime(this.endTimeInput);
+
+ if (!startTime || !endTime) {
+ if (this.settings.defaultTimeDelta !== null) {
+ if (startTime) {
+ var newEnd = new Date(startTime.getTime() + this.settings.defaultTimeDelta);
+ this.settings.updateTime(this.endTimeInput, newEnd);
+ } else if (endTime) {
+ var newStart = new Date(endTime.getTime() - this.settings.defaultTimeDelta);
+ this.settings.updateTime(this.startTimeInput, newStart);
+ }
+
+ this.timeDelta = this.settings.defaultTimeDelta;
+ } else {
+ this.timeDelta = null;
+ }
+
+ return;
+ }
+
+ if (this.settings.anchor == 'start' && hasClass(target, this.settings.startClass)) {
+ var newTime = new Date(startTime.getTime() + this.timeDelta);
+ this.settings.updateTime(this.endTimeInput, newTime);
+ endTime = this.settings.parseTime(this.endTimeInput);
+
+ this._doMidnightRollover(startTime, endTime);
+ } else if (this.settings.anchor == 'end' && hasClass(target, this.settings.endClass)) {
+ var newTime = new Date(endTime.getTime() - this.timeDelta);
+ this.settings.updateTime(this.startTimeInput, newTime);
+ startTime = this.settings.parseTime(this.startTimeInput);
+
+ this._doMidnightRollover(startTime, endTime);
+ } else {
+ this._doMidnightRollover(startTime, endTime);
+
+ var startDate, endDate;
+ if (this.startDateInput && this.endDateInput) {
+ startDate = this.settings.parseDate(this.startDateInput);
+ endDate = this.settings.parseDate(this.endDateInput);
+ }
+
+ if ((+startDate == +endDate) && (endTime < startTime)) {
+ var thisInput = hasClass(target, this.settings.endClass) ? this.endTimeInput : this.startTimeInput;
+ var otherInput = hasClass(target, this.settings.startClass) ? this.endTimeInput : this.startTimeInput;
+ var selectedTime = this.settings.parseTime(thisInput);
+ this.timeDelta = 0;
+ this.settings.updateTime(otherInput, selectedTime);
+ } else {
+ this.timeDelta = endTime.getTime() - startTime.getTime();
+ }
+ }
+
+
+ },
+
+ _doMidnightRollover: function(startTime, endTime) {
+ if (!this.startDateInput || !this.endDateInput) {
+ return;
+ }
+
+ var endDate = this.settings.parseDate(this.endDateInput);
+ var startDate = this.settings.parseDate(this.startDateInput);
+ var newDelta = endTime.getTime() - startTime.getTime();
+ var offset = (endTime < startTime) ? _ONE_DAY : -1 * _ONE_DAY;
+
+ if (this.dateDelta !== null
+ && this.dateDelta + this.timeDelta <= _ONE_DAY
+ && this.dateDelta + newDelta != 0
+ && (offset > 0 || this.dateDelta != 0)
+ && ((newDelta >= 0 && this.timeDelta < 0) || (newDelta < 0 && this.timeDelta >= 0))) {
+
+ if (this.settings.anchor == 'start') {
+ this.settings.updateDate(this.endDateInput, new Date(endDate.getTime() + offset));
+ this._dateChanged(this.endDateInput);
+ } else if (this.settings.anchor == 'end') {
+ this.settings.updateDate(this.startDateInput, new Date(startDate.getTime() - offset));
+ this._dateChanged(this.startDateInput);
+ }
+ }
+ this.timeDelta = newDelta;
+ },
+
+ _updateEndMintime: function(){
+ if (typeof this.settings.setMinTime != 'function') return;
+
+ var baseTime = null;
+ if (this.settings.anchor == 'start' && (!this.dateDelta || this.dateDelta < _ONE_DAY || (this.timeDelta && this.dateDelta + this.timeDelta < _ONE_DAY))) {
+ baseTime = this.settings.parseTime(this.startTimeInput);
+ }
+
+ this.settings.setMinTime(this.endTimeInput, baseTime);
+ },
+
+ _validateRanges: function(){
+ if (this.startTimeInput && this.endTimeInput && this.timeDelta === null) {
+ triggerSimpleCustomEvent(this.container, 'rangeIncomplete');
+ return;
+ }
+
+ if (this.startDateInput && this.endDateInput && this.dateDelta === null) {
+ triggerSimpleCustomEvent(this.container, 'rangeIncomplete');
+ return;
+ }
+
+ // due to the fact that times can wrap around, any time-only pair will be considered valid
+ if (!this.startDateInput || !this.endDateInput || this.dateDelta + this.timeDelta >= 0) {
+ triggerSimpleCustomEvent(this.container, 'rangeSelected');
+ } else {
+ triggerSimpleCustomEvent(this.container, 'rangeError');
+ }
+ }
+};
--- /dev/null
+(function($) {
+
+ if(!$) {
+ return;
+ }
+
+ ////////////
+ // Plugin //
+ ////////////
+
+ $.fn.datepair = function(option) {
+ var out;
+ this.each(function() {
+ var $this = $(this);
+ var data = $this.data('datepair');
+ var options = typeof option === 'object' && option;
+
+ if (!data) {
+ data = new Datepair(this, options);
+ $this.data('datepair', data);
+ }
+
+ if (typeof option === 'string') {
+ out = data[option]();
+ }
+ });
+
+ return out || this;
+ };
+
+ //////////////
+ // Data API //
+ //////////////
+
+ $('[data-datepair]').each(function() {
+ var $this = $(this);
+ $this.datepair($this.data());
+ });
+
+}(window.Zepto || window.jQuery));
--- /dev/null
+(function(window, document) {
+
+ 'use strict';
+
+ //= ./Datepair.js
+
+ window.Datepair = Datepair;
+
+}(window, document));
--- /dev/null
+module.exports = function(grunt) {
+
+ grunt.initConfig({
+ pkg: grunt.file.readJSON('package.json'),
+ meta: {
+ banner : '/*!\n' +
+ ' * <%= pkg.title %> v<%= pkg.version %> - <%= pkg.description %>\n' +
+ ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> - <%= pkg.homepage %>\n' +
+ ' * License: <%= pkg.license %>\n' +
+ ' */\n\n'
+ },
+ uglify: {
+ options : {
+ banner : '<%= meta.banner %>',
+ report: 'gzip'
+ },
+ dist: {
+ files: {
+ 'jquery.timepicker.min.js': ['jquery.timepicker.js']
+ }
+ }
+ },
+ cssmin: {
+ minify: {
+ files: {
+ 'jquery.timepicker.min.css': ['jquery.timepicker.css']
+ }
+ }
+ },
+ jshint: {
+ all: ['jquery.timepicker.js']
+ },
+ });
+
+ grunt.loadNpmTasks('grunt-contrib-uglify');
+ grunt.loadNpmTasks('grunt-contrib-cssmin');
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+
+ grunt.registerTask('default', ['uglify', 'cssmin']);
+
+};
--- /dev/null
+Timepicker Plugin for jQuery
+========================
+
+[<img src="http://jonthornton.github.com/jquery-timepicker/lib/screenshot.png" alt="timepicker screenshot" />](http://jonthornton.github.com/jquery-timepicker)
+
+[See a demo and examples here](http://jonthornton.github.com/jquery-timepicker)
+
+jquery.timepicker is a lightweight timepicker plugin for jQuery inspired by Google Calendar. It supports both mouse and keyboard navigation, and weighs in at 2.7kb minified and gzipped.
+
+Requirements
+------------
+* [jQuery](http://jquery.com/) (>= 1.7)
+
+Usage
+-----
+
+```javascript
+$('.some-time-inputs').timepicker(options);
+```
+
+Include `jquery.timepicker.css` and `jquery.timepicker.min.js` in your page.
+
+```options``` is an optional javascript object with parameters explained below.
+
+You can also set options as [data attributes](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes) on the intput elements, like ```<input type="text" data-time-format="H:i:s" />```. Timepicker still needs to be initialized by calling ```$('#someElement').timepicker();```.
+
+The defaults for all options are exposed through the ```$.fn.timepicker.defaults``` object. Properties changed in this object (same properties configurable through the constructor) will take effect for every instance created after the change.
+
+Options
+-------
+
+- **appendTo**
+Override where the dropdown is appended.
+Takes either a `string` to use as a selector, a `function` that gets passed the clicked input element as argument or a jquery `object` to use directly.
+*default: "body"*
+
+- **className**
+A class name to apply to the HTML element that contains the timepicker dropdown.
+*default: null*
+
+- **closeOnWindowScroll**
+Close the timepicker when the window is scrolled. (Replicates ```<select>``` behavior.)
+*default: false*
+
+- **disableTimeRanges**
+Disable selection of certain time ranges. Input is an array of time pairs, like ```[['3:00am', '4:30am'], ['5:00pm', '8:00pm']]``. The start of the interval will be disabled but the end won't.
+*default: []*
+
+- **disableTextInput**
+Disable typing in the timepicker input box; force users to select from list. [More information here.](https://github.com/jonthornton/jquery-timepicker/issues/425#issuecomment-133262458)
+*default: false*
+
+- **disableTouchKeyboard**
+Disable the onscreen keyboard for touch devices. There can be instances where Firefox or Chrome have touch events enabled (such as on Surface tablets but not actually be a touch device. In this case `disableTouchKeyboard` will prevent the timepicker input field from being focused. [More information here.](https://github.com/jonthornton/jquery-timepicker/issues/413)
+*default: false*
+
+- **durationTime**
+The time against which ```showDuration``` will compute relative times. If this is a function, its result will be used.
+*default: minTime*
+
+- **forceRoundTime**
+Force update the time to ```step``` settings as soon as it loses focus.
+*default: false*
+
+- **lang**
+Language constants used in the timepicker. Can override the defaults by passing an object with one or more of the following properties: decimal, mins, hr, hrs.
+*default:* ```{
+ am: 'am',
+ pm: 'pm',
+ AM: 'AM',
+ PM: 'PM',
+ decimal: '.',
+ mins: 'mins',
+ hr: 'hr',
+ hrs: 'hrs'
+}```
+
+- **maxTime**
+The time that should appear last in the dropdown list. Can be used to limit the range of time options.
+*default: 24 hours after minTime*
+
+- **minTime**
+The time that should appear first in the dropdown list.
+*default: 12:00am*
+
+- **noneOption**
+Adds one or more custom options to the top of the dropdown. Can accept several different value types:
+Boolean (```true```): Adds a "None" option that results in an empty input value
+String: Adds an option with a custom label that results in an empty input value
+Object: Similar to string, but allows customizing the element's class name and the resulting input value. Can contain ```label```, ```value```, and ```className``` properties. ```value``` must be a string type.
+Array: An array of strings or objects to add multiple non-time options
+*default: false*
+
+- **orientation**
+By default the timepicker dropdown will be aligned to the bottom right of the input element, or aligned to the top left if there isn't enough room below the input. Force alignment with `l` (left), `r` (right), `t` (top), and `b` (bottom). Examples: `tl`, `rb`.
+*default: 'l'*
+
+- **roundingFunction**
+Function used to compute rounded times. The function will receive time in seconds and a settings object as arguments. The function should handle a null value for seconds.
+*default: round to nearest step*
+
+- **scrollDefault**
+If no time value is selected, set the dropdown scroll position to show the time provided, e.g. "09:00". A time string, Date object, or integer (seconds past midnight) is acceptible, as well as the string `'now'`.
+*default: null*
+
+- **selectOnBlur**
+Update the input with the currently highlighted time value when the timepicker loses focus.
+*default: false*
+
+- **show2400**
+Show "24:00" as an option when using 24-hour time format. You must also set `timeFormat` for this option to work.
+*default: false*
+
+- **showDuration**
+Shows the relative time for each item in the dropdown. ```minTime``` or ```durationTime``` must be set.
+*default: false*
+
+- **showOn**
+Display a timepicker dropdown when the input fires a particular event. Set to null or an empty array to disable automatic display. Setting should be an array of strings.
+*default: ['focus']*
+
+- **showOnFocus**
+DEPRECATED: Display a timepicker dropdown when the input gains focus.
+*default: true*
+
+- **step**
+The amount of time, in minutes, between each item in the dropdown. Alternately, you can specify a function to generate steps dynamically. The function will receive a count integer (0, 1, 2...) and is expected to return a step integer.
+*default: 30*
+
+- **stopScrollPropagation**
+When scrolling on the edge of the picker, it prevent parent containers (<body>) to scroll.
+*default: false*
+
+- **timeFormat**
+How times should be displayed in the list and input element. Uses [PHP's date() formatting syntax](http://php.net/manual/en/function.date.php). Characters can be escaped with a preceeding double slash (e.g. `H\\hi`). Alternatively, you can specify a function instead of a string, to use completely custom time formatting. In this case, the format function receives a Date object and is expected to return a formatted time as a string.
+*default: 'g:ia'*
+
+- **typeaheadHighlight**
+Highlight the nearest corresponding time option as a value is typed into the form input.
+*default: true*
+
+- **useSelect**
+Convert the input to an HTML `<SELECT>` control. This is ideal for small screen devices, or if you want to prevent the user from entering arbitrary values. This option is not compatible with the following options: ```appendTo```, ```closeOnWindowScroll```, ```disableTouchKeyboard```, ```forceRoundTime```, ```scrollDefault```, ```selectOnBlur```, ```typeAheadHighlight```.
+*default: false*
+
+- **wrapHours**
+If a time greater than 24 hours (27:30, for example) is entered, apply modolo 24 to create a valid time. Setting this to `false` will cause an input of 27:30 to result in a `timeFormatError` event.
+*default: true*
+
+Methods
+-------
+
+- **getSecondsFromMidnight**
+Get the time as an integer, expressed as seconds from 12am.
+
+ ```javascript
+ $('#getTimeExample').timepicker('getSecondsFromMidnight');
+ ```
+
+- **getTime**
+Get the time using a Javascript Date object, relative to a Date object (default: today's date).
+
+ ```javascript
+ $('#getTimeExample').timepicker('getTime');
+ $('#getTimeExample').timepicker('getTime', new Date());
+ ```
+
+ You can get the time as a string using jQuery's built-in ```val()``` function:
+
+ ```javascript
+ $('#getTimeExample').val();
+ ```
+
+- **hide**
+Close the timepicker dropdown.
+
+ ```javascript
+ $('#hideExample').timepicker('hide');
+ ```
+
+- **isVisible**
+Check if the timepicker attached to *a specific input* is visible. Not compatible with the `useSelect` option.
+
+ ```javascript
+ $('#hideExample').timepicker('isVisible');
+ ```
+
+- **option**
+Change the settings of an existing timepicker. Calling ```option``` on a visible timepicker will cause the picker to be hidden.
+
+ ```javascript
+ $('#optionExample').timepicker({ 'timeFormat': 'g:ia' }); // initialize the timepicker sometime earlier in your code
+ ...
+ $('#optionExample').timepicker('option', 'minTime', '2:00am');
+ $('#optionExample').timepicker('option', { 'minTime': '4:00am', 'timeFormat': 'H:i' });
+ ```
+
+- **remove**
+Unbind an existing timepicker element.
+
+ ```javascript
+ $('#removeExample').timepicker('remove');
+ ```
+
+- **setTime**
+Set the time using a Javascript Date object.
+
+ ```javascript
+ $('#setTimeExample').timepicker('setTime', new Date());
+ ```
+
+- **show**
+Display the timepicker dropdown.
+
+ ```javascript
+ $('#showExample').timepicker('show');
+ ```
+
+Events
+------
+
+- **change**
+The native ```onChange``` event will fire any time the input value is updated, whether by selection from the timepicker list or manual entry into the text input. Your code should bind to ```change``` after initializing timepicker, or use [event delegation](http://api.jquery.com/on/).
+
+- **changeTime**
+Called after a valid time value is entered or selected. See ```timeFormatError``` and ```timeRangeError``` for error events. Fires before ```change``` event.
+
+- **hideTimepicker**
+Called after the timepicker is closed.
+
+- **selectTime**
+Called after a time value is selected from the timepicker list. Fires before ```change``` event.
+
+- **showTimepicker**
+Called after the timepicker is shown.
+
+- **timeFormatError**
+Called if an unparseable time string is manually entered into the timepicker input. Fires before ```change``` event.
+
+- **timeRangeError**
+Called if a maxTime, minTime, or disableTimeRanges is set and an invalid time is manually entered into the timepicker input. Fires before ```change``` event.
+
+The `selectTime` and `hideTimepicker` events fire slightly differently when using the `useSelect` option. See https://github.com/jonthornton/jquery-timepicker/issues/427 for more information.
+
+Theming
+-------
+
+Sample markup with class names:
+
+```html
+<input value="5:00pm" class="ui-timepicker-input" type="text">
+...
+<div class="ui-timepicker-wrapper ui-timepicker-positioned-top optional-custom-classname" tabindex="-1">
+ <ul class="ui-timepicker-list">
+ <li class="ui-timepicker-am">12:00am</li>
+ <li class="ui-timepicker-am">12:30am</li>
+ ...
+ <li class="ui-timepicker-pm">4:30pm</li>
+ <li class="ui-timepicker-pm ui-timepicker-selected">5:00pm</li>
+ <li class="ui-timepicker-pm ui-timepicker-disabled">5:30pm</li>
+ <li class="ui-timepicker-pm">6:00pm <span class="ui-timepicker-duration">(1 hour)</span></li>
+ <li class="ui-timepicker-pm">6:30pm</li>
+ ...
+ <li class="ui-timepicker-pm">11:30pm</li>
+ </ul>
+</div>
+```
+
+The `ui-timepicker-positioned-top` class will be applied only when the dropdown is positioned above the input.
+
+## Packaging
+
+Install from [Bower](http://bower.io/) as ```jquery-timepicker-jt```.
+
+An AngularJS directive is available at https://github.com/Recras/angular-jquery-timepicker
+
+Available via CDN at [https://cdnjs.com/libraries/jquery-timepicker](https://cdnjs.com/libraries/jquery-timepicker).
+
+Help
+----
+
+Submit a [GitHub Issues request](https://github.com/jonthornton/jquery-timepicker/issues/new). Please try provide code that demonstrates the problem; you can use [this jsFiddle](http://jsfiddle.net/jonthornton/28uvg/) as a starting point.
+
+Development guidelines
+----------------------
+
+1. Install dependencies (jquery + grunt) `npm install`
+2. For sanity checks and minification run `grunt`, or just `grunt lint` to have the code linted
+
+jquery-timepicker follows [semantic versioning](http://semver.org/).
+
+- - -
+
+This software is made available under the open source MIT License. © 2014 [Jon Thornton](http://www.jonthornton.com) and [contributors](https://github.com/jonthornton/jquery-timepicker/graphs/contributors)
--- /dev/null
+{
+ "name" : "jt.timepicker",
+ "version" : "1.11.1",
+ "description" : "A jQuery timepicker plugin inspired by Google Calendar.",
+ "homepage" : "http://jonthornton.github.com/jquery-timepicker",
+ "main" : [ "./jquery.timepicker.js", "./jquery.timepicker.css" ],
+ "dependencies" : {
+ "jquery" : ">= 1.7"
+ },
+ "keywords" : [ "time", "picker", "google calendar" ],
+ "author" : {
+ "name" : "Jon Thornton",
+ "web" : "https://github.com/jonthornton"
+ },
+ "license": "http://opensource.org/licenses/MIT"
+}
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset='utf-8'>
+
+ <title>Timepicker for jQuery – Demos and Documentation</title>
+ <meta name="description" content="A lightweight, customizable jQuery timepicker plugin inspired by Google Calendar. Add a user-friendly javascript timepicker dropdown to your app in minutes." />
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
+
+ <script type="text/javascript" src="jquery.timepicker.js"></script>
+ <link rel="stylesheet" type="text/css" href="jquery.timepicker.css" />
+
+ <script type="text/javascript" src="lib/bootstrap-datepicker.js"></script>
+ <link rel="stylesheet" type="text/css" href="lib/bootstrap-datepicker.css" />
+
+ <script type="text/javascript" src="lib/site.js"></script>
+ <link rel="stylesheet" type="text/css" href="lib/site.css" />
+
+</head>
+
+<body>
+ <header>
+
+ <h1><a href="https://github.com/jonthornton/jquery-timepicker">jquery.timepicker</a></h1>
+ <p class="body-text">
+ A lightweight, customizable javascript timepicker plugin for jQuery inspired by Google Calendar.
+ </p>
+
+ <ul id="header-links">
+ <li><a href="https://github.com/jonthornton/jquery-timepicker#timepicker-plugin-for-jquery">Documentation</a></li>
+ <li><a href="https://github.com/jonthornton/jquery-timepicker">Source code on GitHub</a></li>
+ <li><a href="https://github.com/jonthornton/jquery-timepicker/zipball/master">Download (zip)</a></li>
+ <li><a href="https://github.com/jonthornton/jquery-timepicker/issues?state=open">Help</a></li>
+ </ul>
+ </header>
+
+ <section>
+ <p class="body-text">Use this plugin to unobtrusively add a timepicker dropdown to your forms. It's lightweight (2.7kb minified and gzipped) and easy to customize.</p>
+ </section>
+
+ <section id="examples">
+ <article>
+ <div class="demo">
+ <h2>Basic Example</h2>
+ <p><input id="basicExample" type="text" class="time" /></p>
+ </div>
+
+ <script>
+ $(function() {
+ $('#basicExample').timepicker();
+ });
+ </script>
+
+ <pre class="code" data-language="javascript">$('#basicExample').timepicker();</pre>
+ </article>
+
+
+ <article>
+ <div class="demo">
+ <h2>Scroll Default Example</h2>
+ <p>Set the scroll position to local time if no value selected.</p>
+ <p><input id="scrollDefaultExample" type="text" class="time" /></p>
+ </div>
+
+ <script>
+ $(function() {
+ $('#scrollDefaultExample').timepicker({ 'scrollDefault': 'now' });
+ });
+ </script>
+
+ <pre class="code" data-language="javascript">$('#scrollDefaultExample').timepicker({ 'scrollDefault': 'now' });</pre>
+ </article>
+
+ <article>
+ <div class="demo">
+ <h2>Set Time Example</h2>
+ <p>Dynamically set the time using a Javascript Date object.</p>
+ <p>
+ <input id="setTimeExample" type="text" class="time" />
+ <button id="setTimeButton">Set current time</button>
+ </p>
+ </div>
+
+ <script>
+ $(function() {
+ $('#setTimeExample').timepicker();
+ $('#setTimeButton').on('click', function (){
+ $('#setTimeExample').timepicker('setTime', new Date());
+ });
+ });
+ </script>
+
+ <pre class="code" data-language="javascript">$('#setTimeExample').timepicker();
+$('#setTimeButton').on('click', function (){
+ $('#setTimeExample').timepicker('setTime', new Date());
+});</pre>
+ </article>
+
+ <article>
+ <div class="demo">
+ <h2>Duration Example</h2>
+ <p>Set a starting time and see duration from that starting time. You can optionally set an maxTime as well.</p>
+ <p><input id="durationExample" type="text" class="time" /></p>
+ </div>
+
+ <script>
+ $(function() {
+ $('#durationExample').timepicker({
+ 'minTime': '2:00pm',
+ 'maxTime': '11:30pm',
+ 'showDuration': true
+ });
+ });
+ </script>
+
+ <pre class="code" data-language="javascript">$('#durationExample').timepicker({
+ 'minTime': '2:00pm',
+ 'maxTime': '11:30pm',
+ 'showDuration': true
+});</pre>
+ </article>
+
+ <article>
+ <div class="demo">
+ <h2>Event Example</h2>
+ <p>Trigger an event after selecting a value. Fires before the input onchange event.</p>
+ <p>
+ <input id="onselectExample" type="text" class="time" />
+ <span id="onselectTarget" style="margin-left: 30px;"></span>
+ </p>
+ </div>
+
+ <script>
+ $(function() {
+ $('#onselectExample').timepicker();
+ $('#onselectExample').on('changeTime', function() {
+ $('#onselectTarget').text($(this).val());
+ });
+ });
+ </script>
+
+ <pre class="code" data-language="javascript">$('#onselectExample').timepicker();
+$('#onselectExample').on('changeTime', function() {
+ $('#onselectTarget').text($(this).val());
+});</pre>
+ </article>
+
+ <article>
+ <div class="demo">
+ <h2>DisableTimeRanges Example</h2>
+ <p>Prevent selection of certain time values.</p>
+ <p><input id="disableTimeRangesExample" type="text" class="time" /></p>
+ </div>
+
+ <script>
+ $(function() {
+ $('#disableTimeRangesExample').timepicker({ 'disableTimeRanges': [['1am', '2am'], ['3am', '4:01am']] });
+ });
+ </script>
+
+ <pre class="code" data-language="javascript">$('#disableTimeRangesExample').timepicker({
+ 'disableTimeRanges': [
+ ['1am', '2am'],
+ ['3am', '4:01am']
+ ]
+});</pre>
+ </article>
+
+ <article>
+ <div class="demo">
+ <h2>noneOption Example</h2>
+ <p>Custom options can be added to the dropdown menu.</p>
+ <p><input id="noneOptionExample" type="text" class="time" /></p>
+ </div>
+
+ <script>
+ $(function() {
+ $('#noneOptionExample').timepicker({
+ 'noneOption': [
+ {
+ 'label': 'Foobar',
+ 'className': 'shibby',
+ 'value': '42'
+ },
+ 'Foobar2'
+ ]
+ });
+ });
+ </script>
+
+ <pre class="code" data-language="javascript">
+$('#noneOptionExample').timepicker({
+ 'noneOption': [
+ {
+ 'label': 'Foobar',
+ 'className': 'shibby',
+ 'value': '42'
+ },
+ 'Foobar2'
+ ]
+});
+ </pre>
+ </article>
+
+ <article>
+ <div class="demo">
+ <h2>timeFormat Example</h2>
+ <p>timepicker.jquery uses the time portion of <a href="http://php.net/manual/en/function.date.php">PHP's date formatting commands</a>.</p>
+ <p><input id="timeformatExample1" type="text" class="time" /> <input id="timeformatExample2" type="text" class="time" /></p>
+ </div>
+
+ <script>
+ $(function() {
+ $('#timeformatExample1').timepicker({ 'timeFormat': 'H:i:s' });
+ $('#timeformatExample2').timepicker({ 'timeFormat': 'h:i A' });
+ });
+ </script>
+
+ <pre class="code" data-language="javascript">$('#timeformatExample1').timepicker({ 'timeFormat': 'H:i:s' });
+$('#timeformatExample2').timepicker({ 'timeFormat': 'h:i A' });</pre>
+ </article>
+
+ <article>
+ <div class="demo">
+ <h2>Step Example</h2>
+ <p>Generate drop-down options with varying levels of precision.</p>
+ <p><input id="stepExample1" type="text" class="time" /> <input id="stepExample2" type="text" class="time" /></p>
+ </div>
+
+ <script>
+ $(function() {
+ $('#stepExample1').timepicker({ 'step': 15 });
+ $('#stepExample2').timepicker({
+ 'step': function(i) {
+ return (i%2) ? 15 : 45;
+ }
+ });
+ });
+ </script>
+
+ <pre class="code" data-language="javascript">$('#stepExample1').timepicker({ 'step': 15 });
+$('#stepExample2').timepicker({
+ 'step': function(i) {
+ return (i%2) ? 15 : 45;
+ }
+});</pre>
+ </article>
+
+ <article>
+ <div class="demo">
+ <h2>forceRoundTime Example</h2>
+ <p>jquery-timepicker allows entering times via the keyboard. Setting forceRoundTime to true will
+ round the entered time to the nearest option on the dropdown list.</p>
+ <p><input id="roundTimeExample" type="text" class="time" /> </p>
+ </div>
+
+ <script>
+ $(function() {
+ $('#roundTimeExample').timepicker({ 'forceRoundTime': true });
+ });
+ </script>
+
+ <pre class="code" data-language="javascript">$('#roundTimeExample').timepicker({ 'forceRoundTime': true });</pre>
+ </article>
+
+ <article>
+ <div class="demo">
+ <h2>Select Example</h2>
+ <p>jquery-timepicker can render itself as a select element too.</p>
+ <p><input id="selectExample" class="time" /> <button id="selectButton">Toggle</button></p>
+ </div>
+
+ <script>
+ $(function() {
+ $('#selectExample').timepicker();
+ $('#selectButton').click(function(e) {
+ $('#selectExample').timepicker('option', { useSelect: true });
+ $(this).hide();
+ });
+ });
+ </script>
+
+ <pre class="code" data-language="javascript">$('#selectExample').timepicker();
+$('#selectButton').click(function(e) {
+ $('#selectExample').timepicker('option', { useSelect: true });
+ $(this).hide();
+});</pre>
+ </article>
+
+ <article>
+ <div class="demo">
+ <h2>Non-input Example</h2>
+ <p>jquery-timepicker can be bound to any visibile DOM element, such as spans or divs.</p>
+ <p><span id="spanExample" style="background:#f00; padding:0 10px; margin-right:100px;"></span> <button id="openSpanExample">Pick Time</button> </p>
+ </div>
+
+ <script>
+ $(function() {
+ $('#spanExample').timepicker();
+ $('#openSpanExample').on('click', function(){
+ $('#spanExample').timepicker('show');
+ });
+ });
+ </script>
+
+ <pre class="code" data-language="javascript">$('#spanExample').timepicker();
+ $('#openSpanExample').on('click', function(){
+ $('#spanExample').timepicker('show');
+});</pre>
+ </article>
+
+ <article>
+ <div class="demo">
+ <h2>Datepair Plugin Example</h2>
+
+ <p>jquery-timepicker is designed to work with the <a href="http://jonthornton.github.com/Datepair.js">jquery-datepair plugin</a>.
+
+ <p id="datepairExample">
+ <input type="text" class="date start" />
+ <input type="text" class="time start" /> to
+ <input type="text" class="time end" />
+ <input type="text" class="date end" />
+ </p>
+ </div>
+
+ <script src="http://jonthornton.github.io/Datepair.js/dist/datepair.js"></script>
+ <script src="http://jonthornton.github.io/Datepair.js/dist/jquery.datepair.js"></script>
+ <script>
+ $('#datepairExample .time').timepicker({
+ 'showDuration': true,
+ 'timeFormat': 'g:ia'
+ });
+
+ $('#datepairExample .date').datepicker({
+ 'format': 'm/d/yyyy',
+ 'autoclose': true
+ });
+
+ $('#datepairExample').datepair();
+ </script>
+
+ <pre class="code" data-language="javascript">
+<p id="datepairExample">
+ <input type="text" class="date start" />
+ <input type="text" class="time start" /> to
+ <input type="text" class="time end" />
+ <input type="text" class="date end" />
+</p>
+
+<script type="text/javascript" src="datepair.js"></script>
+<script type="text/javascript" src="jquery.datepair.js"></script>
+<script>
+ // initialize input widgets first
+ $('#datepairExample .time').timepicker({
+ 'showDuration': true,
+ 'timeFormat': 'g:ia'
+ });
+
+ $('#datepairExample .date').datepicker({
+ 'format': 'yyyy-m-d',
+ 'autoclose': true
+ });
+
+ // initialize datepair
+ $('#datepairExample').datepair();
+</script></pre>
+
+ </article>
+ </section>
+
+ <section>
+ <h2>Need Help?</h2>
+ <p>Check <a href="https://github.com/jonthornton/jquery-timepicker#timepicker-plugin-for-jquery">the documentation</a> or <a href="https://github.com/jonthornton/jquery-timepicker/issues?state=open">submit an issue</a> on GitHub.</p>
+ </section>
+
+ <footer>
+ <p>© 2014 <a href="http://jonthornton.com">Jon Thornton</a></p>
+ </footer>
+
+ <script>
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
+
+ ga('create', 'UA-15605525-4', 'auto');
+ ga('send', 'pageview');
+
+ </script>
+</div></body>
+</html>
--- /dev/null
+.ui-timepicker-wrapper {
+ overflow-y: auto;
+ height: 150px;
+ width: 6.5em;
+ background: #fff;
+ border: 1px solid #ddd;
+ -webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);
+ -moz-box-shadow:0 5px 10px rgba(0,0,0,0.2);
+ box-shadow:0 5px 10px rgba(0,0,0,0.2);
+ outline: none;
+ z-index: 10001;
+ margin: 0;
+}
+
+.ui-timepicker-wrapper.ui-timepicker-with-duration {
+ width: 13em;
+}
+
+.ui-timepicker-wrapper.ui-timepicker-with-duration.ui-timepicker-step-30,
+.ui-timepicker-wrapper.ui-timepicker-with-duration.ui-timepicker-step-60 {
+ width: 11em;
+}
+
+.ui-timepicker-list {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+}
+
+.ui-timepicker-duration {
+ margin-left: 5px; color: #888;
+}
+
+.ui-timepicker-list:hover .ui-timepicker-duration {
+ color: #888;
+}
+
+.ui-timepicker-list li {
+ padding: 3px 0 3px 5px;
+ cursor: pointer;
+ white-space: nowrap;
+ color: #000;
+ list-style: none;
+ margin: 0;
+}
+
+.ui-timepicker-list:hover .ui-timepicker-selected {
+ background: #fff; color: #000;
+}
+
+li.ui-timepicker-selected,
+.ui-timepicker-list li:hover,
+.ui-timepicker-list .ui-timepicker-selected:hover {
+ background: #1980EC; color: #fff;
+}
+
+li.ui-timepicker-selected .ui-timepicker-duration,
+.ui-timepicker-list li:hover .ui-timepicker-duration {
+ color: #ccc;
+}
+
+.ui-timepicker-list li.ui-timepicker-disabled,
+.ui-timepicker-list li.ui-timepicker-disabled:hover,
+.ui-timepicker-list li.ui-timepicker-selected.ui-timepicker-disabled {
+ color: #888;
+ cursor: default;
+}
+
+.ui-timepicker-list li.ui-timepicker-disabled:hover,
+.ui-timepicker-list li.ui-timepicker-selected.ui-timepicker-disabled {
+ background: #f2f2f2;
+}
--- /dev/null
+// Type definitions for jQuery.timepicker 1.11.1
+// https://github.com/jonthornton/jquery-timepicker
+
+/**
+ * Declaring a namespace because there are several jquery timepickers already out there on DefinitelyTyped. Jt stands for Jon Thornton
+ */
+declare namespace Jt.Timepicker {
+
+ /**
+ * Options object for the jquery.timepicker
+ */
+ export interface Options {
+ /**
+ * Default: 'body'
+ * Override where the dropdown is appended.
+ * Takes either a string to use as a selector, a function that gets passed the clicked input element as argument or a jquery object to use directly.
+ */
+ appendTo?: string | ((clickedElement) => string);
+ /**
+ * Default: null
+ * A class name to apply to the HTML element that contains the timepicker dropdown.
+ */
+ className?: string;
+ /**
+ * Default: false
+ * Close the timepicker when the window is scrolled. (Replicates <select> behavior.)
+ */
+ closeOnWindowScroll?: boolean;
+ /**
+ * Default: false
+ * Disable typing in the timepicker input box; force users to select from list.
+ * More information https://github.com/jonthornton/jquery-timepicker/issues/425#issuecomment-133262458
+ */
+ disableTextInput?: boolean;
+ /**
+ * Default: []
+ * Disable selection of certain time ranges. Input is an array of time pairs, like `[['3:00am', '4:30am'], ['5:00pm', '8:00pm']].
+ * The start of the interval will be disabled but the end won't.
+ */
+ disableTimeRanges?: Array<string[]>;
+ /**
+ * Default: false
+ * Disables the onscreen keyboard for touch devices. There can be instances where Firefox or Chrome have touch events enabled
+ * (such as on Surface tablets but not actually be a touch device. In this case disableTouchKeyboard will prevent the timepicker
+ * input field from being focused.
+ * More information: https://github.com/jonthornton/jquery-timepicker/issues/413
+ */
+ disableTouchKeyboard?: boolean;
+ /**
+ * Default: Same as the minTime
+ * The time against which showDuration will compute relative times. This should be given as a formatted date string.
+ */
+ durationTime?: string | Date | (() => string | Date);
+ /**
+ * Default: false
+ * Force update the time to step settings as soon as it loses focus`.
+ */
+ forceRoundTime?: boolean;
+ /**
+ * Default: 24 hours after minTime
+ * The time that should appear last in the dropdown list. Can be used to limit the range of time options.
+ */
+ maxTime?: Date | string;
+ /**
+ * Default: 12:00 am
+ * The time that should appear first in the dropdown list.
+ */
+ minTime?: Date | string;
+ /**
+ * Default: false.
+ * Adds one or more custom options to the top of the dropdown. Can accept several different value types:
+ * Boolean (true): Adds a "None" option that results in an empty input value
+ * String: Adds an option with a custom label that results in an empty input value
+ * Object: Similar to string, but allows customizing the element's class name and the resulting input value. Can contain label, value, and className properties. The value property must be a string type.
+ * Array: An array of strings or objects to add multiple non-time options
+ */
+ noneOption?: boolean | string | string[] | NoneObject;
+ /**
+ * default: 'l'
+ * By default the timepicker dropdown will be aligned to the bottom right of the input element, or aligned to the top left if there isn't enough room below the input. Force alignment with l (left), r (right), t (top), and b (bottom). Examples: tl, rb.
+ */
+ orientation?: string;
+ /**
+ * Default: Rounds to the nearest step
+ * Function used to compute rounded times. The function will receive time in seconds and a settings object as arguments. The function should handle a null value for seconds
+ */
+ roundingFunction?: (seconds: number, settings: Options) => number;
+ /**
+ * Default: null
+ * If no time value is selected, set the dropdown scroll position to show the time provided, e.g. "09:00". A time string, Date object, or integer (seconds past midnight) is acceptible, as well as the string 'now'
+ */
+ scrollDefault?: string | Date | number | {};
+ /**
+ * Default: false
+ * Update the input with the currently highlighted time value when the timepicker loses focus.
+ */
+ selectOnBlur?: boolean;
+ /**
+ * Default: false
+ * Show "24:00" as an option when using 24-hour time format
+ */
+ show2400?: boolean;
+ /**
+ * Default: false
+ * Shows the relative time for each item in the dropdown. minTime or durationTime must be set.
+ */
+ showDuration?: boolean;
+ /**
+ * Default: ["click", "focus"]
+ * Display a timepicker dropdown when the input fires a particular event. Set to null or an empty array to disable automatic display. Setting should be an array of strings
+ */
+ showOn?: string[];
+ /**
+ * @deprecated Display a timepicker dropdown when the input gains focus.
+ * Default: true
+ */
+ showOnFocus?: boolean;
+ /**
+ * Default: 30
+ * The amount of time, in minutes, between each item in the dropdown. Alternately, you can specify a function to generate steps dynamically. The function will receive a count integer (0, 1, 2...) and is expected to return a step integer.
+ */
+ step?: number;
+ /**
+ * Default: false
+ * When scrolling on the edge of the picker, it prevent parent containers () to scroll
+ */
+ stopScrollPropagation?: boolean;
+ /**
+ * Default: 'g:ia'
+ * How times should be displayed in the list and input element. Uses PHP's date() formatting syntax. Characters can be escaped with a preceeding double slash (e.g. H\\hi). Alternatively, you can specify a function instead of a string, to use completely custom time formatting. In this case, * the format function receives a Date object and is expected to return a formatted time as a string
+ */
+ timeFormat?: string | ((givenDate: Date) => string);
+ /**
+ * Default: true
+ * Highlight the nearest corresponding time option as a value is typed into the form input.
+ */
+ typeaheadHighlight?: boolean;
+ /**
+ * Default: false
+ * Convert the input to an HTML <SELECT> control. This is ideal for small screen devices, or if you want to prevent the user from entering
+ * arbitrary values. This option is not compatible with the following options: appendTo, closeOnWindowScroll, disableTouchKeyboard,
+ * scrollDefault, selectOnBlur, typeAheadHighlight.
+ */
+ useSelect?: boolean;
+ }
+
+ export interface NoneObject {
+ label: string;
+ value: string;
+ className: string;
+ }
+}
--- /dev/null
+/*!
+ * jquery-timepicker v1.11.1 - A jQuery timepicker plugin inspired by Google Calendar. It supports both mouse and keyboard navigation.
+ * Copyright (c) 2015 Jon Thornton - http://jonthornton.github.com/jquery-timepicker/
+ * License: MIT
+ */
+
+
+(function (factory) {
+ if (typeof exports === "object" && exports &&
+ typeof module === "object" && module && module.exports === exports) {
+ // Browserify. Attach to jQuery module.
+ factory(require("jquery"));
+ } else if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(['jquery'], factory);
+ } else {
+ // Browser globals
+ factory(jQuery);
+ }
+}(function ($) {
+ var _ONE_DAY = 86400;
+ var _lang = {
+ am: 'am',
+ pm: 'pm',
+ AM: 'AM',
+ PM: 'PM',
+ decimal: '.',
+ mins: 'mins',
+ hr: 'hr',
+ hrs: 'hrs'
+ };
+
+ var methods = {
+ init: function(options)
+ {
+ return this.each(function()
+ {
+ var self = $(this);
+
+ // pick up settings from data attributes
+ var attributeOptions = [];
+ for (var key in $.fn.timepicker.defaults) {
+ if (self.data(key)) {
+ attributeOptions[key] = self.data(key);
+ }
+ }
+
+ var settings = $.extend({}, $.fn.timepicker.defaults, attributeOptions, options);
+
+ if (settings.lang) {
+ _lang = $.extend(_lang, settings.lang);
+ }
+
+ settings = _parseSettings(settings);
+ self.data('timepicker-settings', settings);
+ self.addClass('ui-timepicker-input');
+
+ if (settings.useSelect) {
+ _render(self);
+ } else {
+ self.prop('autocomplete', 'off');
+ if (settings.showOn) {
+ for (var i in settings.showOn) {
+ self.on(settings.showOn[i]+'.timepicker', methods.show);
+ }
+ }
+ self.on('change.timepicker', _formatValue);
+ self.on('keydown.timepicker', _keydownhandler);
+ self.on('keyup.timepicker', _keyuphandler);
+ if (settings.disableTextInput) {
+ self.on('keydown.timepicker', _disableTextInputHandler);
+ }
+
+ _formatValue.call(self.get(0));
+ }
+ });
+ },
+
+ show: function(e)
+ {
+ var self = $(this);
+ var settings = self.data('timepicker-settings');
+
+ if (e) {
+ e.preventDefault();
+ }
+
+ if (settings.useSelect) {
+ self.data('timepicker-list').focus();
+ return;
+ }
+
+ if (_hideKeyboard(self)) {
+ // block the keyboard on mobile devices
+ self.blur();
+ }
+
+ var list = self.data('timepicker-list');
+
+ // check if input is readonly
+ if (self.prop('readonly')) {
+ return;
+ }
+
+ // check if list needs to be rendered
+ if (!list || list.length === 0 || typeof settings.durationTime === 'function') {
+ _render(self);
+ list = self.data('timepicker-list');
+ }
+
+ if (_isVisible(list)) {
+ return;
+ }
+
+ self.data('ui-timepicker-value', self.val());
+ _setSelected(self, list);
+
+ // make sure other pickers are hidden
+ methods.hide();
+
+ // position the dropdown relative to the input
+ list.show();
+ var listOffset = {};
+
+ if (settings.orientation.match(/r/)) {
+ // right-align the dropdown
+ listOffset.left = self.offset().left + self.outerWidth() - list.outerWidth() + parseInt(list.css('marginLeft').replace('px', ''), 10);
+ } else {
+ // left-align the dropdown
+ listOffset.left = self.offset().left + parseInt(list.css('marginLeft').replace('px', ''), 10);
+ }
+
+ var verticalOrientation;
+ if (settings.orientation.match(/t/)) {
+ verticalOrientation = 't';
+ } else if (settings.orientation.match(/b/)) {
+ verticalOrientation = 'b';
+ } else if ((self.offset().top + self.outerHeight(true) + list.outerHeight()) > $(window).height() + $(window).scrollTop()) {
+ verticalOrientation = 't';
+ } else {
+ verticalOrientation = 'b';
+ }
+
+ if (verticalOrientation == 't') {
+ // position the dropdown on top
+ list.addClass('ui-timepicker-positioned-top');
+ listOffset.top = self.offset().top - list.outerHeight() + parseInt(list.css('marginTop').replace('px', ''), 10);
+ } else {
+ // put it under the input
+ list.removeClass('ui-timepicker-positioned-top');
+ listOffset.top = self.offset().top + self.outerHeight() + parseInt(list.css('marginTop').replace('px', ''), 10);
+ }
+
+ list.offset(listOffset);
+
+ // position scrolling
+ var selected = list.find('.ui-timepicker-selected');
+
+ if (!selected.length) {
+ var timeInt = _time2int(_getTimeValue(self));
+ if (timeInt !== null) {
+ selected = _findRow(self, list, timeInt);
+ } else if (settings.scrollDefault) {
+ selected = _findRow(self, list, settings.scrollDefault());
+ }
+ }
+
+ if (selected && selected.length) {
+ var topOffset = list.scrollTop() + selected.position().top - selected.outerHeight();
+ list.scrollTop(topOffset);
+ } else {
+ list.scrollTop(0);
+ }
+
+ // prevent scroll propagation
+ if(settings.stopScrollPropagation) {
+ $(document).on('wheel.ui-timepicker', '.ui-timepicker-wrapper', function(e){
+ e.preventDefault();
+ var currentScroll = $(this).scrollTop();
+ $(this).scrollTop(currentScroll + e.originalEvent.deltaY);
+ });
+ }
+
+ // attach close handlers
+ $(document).on('touchstart.ui-timepicker mousedown.ui-timepicker', _closeHandler);
+ $(window).on('resize.ui-timepicker', _closeHandler);
+ if (settings.closeOnWindowScroll) {
+ $(document).on('scroll.ui-timepicker', _closeHandler);
+ }
+
+ self.trigger('showTimepicker');
+
+ return this;
+ },
+
+ hide: function(e)
+ {
+ var self = $(this);
+ var settings = self.data('timepicker-settings');
+
+ if (settings && settings.useSelect) {
+ self.blur();
+ }
+
+ $('.ui-timepicker-wrapper').each(function() {
+ var list = $(this);
+ if (!_isVisible(list)) {
+ return;
+ }
+
+ var self = list.data('timepicker-input');
+ var settings = self.data('timepicker-settings');
+
+ if (settings && settings.selectOnBlur) {
+ _selectValue(self);
+ }
+
+ list.hide();
+ self.trigger('hideTimepicker');
+ });
+
+ return this;
+ },
+
+ option: function(key, value)
+ {
+ if (typeof key == 'string' && typeof value == 'undefined') {
+ return $(this).data('timepicker-settings')[key];
+ }
+
+ return this.each(function(){
+ var self = $(this);
+ var settings = self.data('timepicker-settings');
+ var list = self.data('timepicker-list');
+
+ if (typeof key == 'object') {
+ settings = $.extend(settings, key);
+ } else if (typeof key == 'string') {
+ settings[key] = value;
+ }
+
+ settings = _parseSettings(settings);
+
+ self.data('timepicker-settings', settings);
+
+ if (list) {
+ list.remove();
+ self.data('timepicker-list', false);
+ }
+
+ if (settings.useSelect) {
+ _render(self);
+ }
+ });
+ },
+
+ getSecondsFromMidnight: function()
+ {
+ return _time2int(_getTimeValue(this));
+ },
+
+ getTime: function(relative_date)
+ {
+ var self = this;
+
+ var time_string = _getTimeValue(self);
+ if (!time_string) {
+ return null;
+ }
+
+ var offset = _time2int(time_string);
+ if (offset === null) {
+ return null;
+ }
+
+ if (!relative_date) {
+ relative_date = new Date();
+ }
+
+ // construct a Date from relative date, and offset's time
+ var time = new Date(relative_date);
+ time.setHours(offset / 3600);
+ time.setMinutes(offset % 3600 / 60);
+ time.setSeconds(offset % 60);
+ time.setMilliseconds(0);
+
+ return time;
+ },
+
+ isVisible: function() {
+ var self = this;
+ var list = self.data('timepicker-list');
+ return !!(list && _isVisible(list));
+ },
+
+ setTime: function(value)
+ {
+ var self = this;
+ var settings = self.data('timepicker-settings');
+
+ if (settings.forceRoundTime) {
+ var prettyTime = _roundAndFormatTime(_time2int(value), settings)
+ } else {
+ var prettyTime = _int2time(_time2int(value), settings);
+ }
+
+ if (value && prettyTime === null && settings.noneOption) {
+ prettyTime = value;
+ }
+
+ _setTimeValue(self, prettyTime);
+ if (self.data('timepicker-list')) {
+ _setSelected(self, self.data('timepicker-list'));
+ }
+
+ return this;
+ },
+
+ remove: function()
+ {
+ var self = this;
+
+ // check if this element is a timepicker
+ if (!self.hasClass('ui-timepicker-input')) {
+ return;
+ }
+
+ var settings = self.data('timepicker-settings');
+ self.removeAttr('autocomplete', 'off');
+ self.removeClass('ui-timepicker-input');
+ self.removeData('timepicker-settings');
+ self.off('.timepicker');
+
+ // timepicker-list won't be present unless the user has interacted with this timepicker
+ if (self.data('timepicker-list')) {
+ self.data('timepicker-list').remove();
+ }
+
+ if (settings.useSelect) {
+ self.show();
+ }
+
+ self.removeData('timepicker-list');
+
+ return this;
+ }
+ };
+
+ // private methods
+
+ function _isVisible(elem)
+ {
+ var el = elem[0];
+ return el.offsetWidth > 0 && el.offsetHeight > 0;
+ }
+
+ function _parseSettings(settings)
+ {
+ if (settings.minTime) {
+ settings.minTime = _time2int(settings.minTime);
+ }
+
+ if (settings.maxTime) {
+ settings.maxTime = _time2int(settings.maxTime);
+ }
+
+ if (settings.durationTime && typeof settings.durationTime !== 'function') {
+ settings.durationTime = _time2int(settings.durationTime);
+ }
+
+ if (settings.scrollDefault == 'now') {
+ settings.scrollDefault = function() {
+ return settings.roundingFunction(_time2int(new Date()), settings);
+ }
+ } else if (settings.scrollDefault && typeof settings.scrollDefault != 'function') {
+ var val = settings.scrollDefault;
+ settings.scrollDefault = function() {
+ return settings.roundingFunction(_time2int(val), settings);
+ }
+ } else if (settings.minTime) {
+ settings.scrollDefault = function() {
+ return settings.roundingFunction(settings.minTime, settings);
+ }
+ }
+
+ if ($.type(settings.timeFormat) === "string" && settings.timeFormat.match(/[gh]/)) {
+ settings._twelveHourTime = true;
+ }
+
+ if (settings.showOnFocus === false && settings.showOn.indexOf('focus') != -1) {
+ settings.showOn.splice(settings.showOn.indexOf('focus'), 1);
+ }
+
+ if (settings.disableTimeRanges.length > 0) {
+ // convert string times to integers
+ for (var i in settings.disableTimeRanges) {
+ settings.disableTimeRanges[i] = [
+ _time2int(settings.disableTimeRanges[i][0]),
+ _time2int(settings.disableTimeRanges[i][1])
+ ];
+ }
+
+ // sort by starting time
+ settings.disableTimeRanges = settings.disableTimeRanges.sort(function(a, b){
+ return a[0] - b[0];
+ });
+
+ // merge any overlapping ranges
+ for (var i = settings.disableTimeRanges.length-1; i > 0; i--) {
+ if (settings.disableTimeRanges[i][0] <= settings.disableTimeRanges[i-1][1]) {
+ settings.disableTimeRanges[i-1] = [
+ Math.min(settings.disableTimeRanges[i][0], settings.disableTimeRanges[i-1][0]),
+ Math.max(settings.disableTimeRanges[i][1], settings.disableTimeRanges[i-1][1])
+ ];
+ settings.disableTimeRanges.splice(i, 1);
+ }
+ }
+ }
+
+ return settings;
+ }
+
+ function _render(self)
+ {
+ var settings = self.data('timepicker-settings');
+ var list = self.data('timepicker-list');
+
+ if (list && list.length) {
+ list.remove();
+ self.data('timepicker-list', false);
+ }
+
+ if (settings.useSelect) {
+ list = $('<select />', { 'class': 'ui-timepicker-select' });
+ var wrapped_list = list;
+ } else {
+ list = $('<ul />', { 'class': 'ui-timepicker-list' });
+
+ var wrapped_list = $('<div />', { 'class': 'ui-timepicker-wrapper', 'tabindex': -1 });
+ wrapped_list.css({'display':'none', 'position': 'absolute' }).append(list);
+ }
+
+ if (settings.noneOption) {
+ if (settings.noneOption === true) {
+ settings.noneOption = (settings.useSelect) ? 'Time...' : 'None';
+ }
+
+ if ($.isArray(settings.noneOption)) {
+ for (var i in settings.noneOption) {
+ if (parseInt(i, 10) == i){
+ var noneElement = _generateNoneElement(settings.noneOption[i], settings.useSelect);
+ list.append(noneElement);
+ }
+ }
+ } else {
+ var noneElement = _generateNoneElement(settings.noneOption, settings.useSelect);
+ list.append(noneElement);
+ }
+ }
+
+ if (settings.className) {
+ wrapped_list.addClass(settings.className);
+ }
+
+ if ((settings.minTime !== null || settings.durationTime !== null) && settings.showDuration) {
+ var stepval = typeof settings.step == 'function' ? 'function' : settings.step;
+ wrapped_list.addClass('ui-timepicker-with-duration');
+ wrapped_list.addClass('ui-timepicker-step-'+settings.step);
+ }
+
+ var durStart = settings.minTime;
+ if (typeof settings.durationTime === 'function') {
+ durStart = _time2int(settings.durationTime());
+ } else if (settings.durationTime !== null) {
+ durStart = settings.durationTime;
+ }
+ var start = (settings.minTime !== null) ? settings.minTime : 0;
+ var end = (settings.maxTime !== null) ? settings.maxTime : (start + _ONE_DAY - 1);
+
+ if (end < start) {
+ // make sure the end time is greater than start time, otherwise there will be no list to show
+ end += _ONE_DAY;
+ }
+
+ if (end === _ONE_DAY-1 && $.type(settings.timeFormat) === "string" && settings.show2400) {
+ // show a 24:00 option when using military time
+ end = _ONE_DAY;
+ }
+
+ var dr = settings.disableTimeRanges;
+ var drCur = 0;
+ var drLen = dr.length;
+
+ var stepFunc = settings.step;
+ if (typeof stepFunc != 'function') {
+ stepFunc = function() {
+ return settings.step;
+ }
+ }
+
+ for (var i=start, j=0; i <= end; j++, i += stepFunc(j)*60) {
+ var timeInt = i;
+ var timeString = _int2time(timeInt, settings);
+
+ if (settings.useSelect) {
+ var row = $('<option />', { 'value': timeString });
+ row.text(timeString);
+ } else {
+ var row = $('<li />');
+ row.addClass(timeInt % 86400 < 43200 ? 'ui-timepicker-am' : 'ui-timepicker-pm');
+ row.data('time', (timeInt <= 86400 ? timeInt : timeInt % 86400));
+ row.text(timeString);
+ }
+
+ if ((settings.minTime !== null || settings.durationTime !== null) && settings.showDuration) {
+ var durationString = _int2duration(i - durStart, settings.step);
+ if (settings.useSelect) {
+ row.text(row.text()+' ('+durationString+')');
+ } else {
+ var duration = $('<span />', { 'class': 'ui-timepicker-duration' });
+ duration.text(' ('+durationString+')');
+ row.append(duration);
+ }
+ }
+
+ if (drCur < drLen) {
+ if (timeInt >= dr[drCur][1]) {
+ drCur += 1;
+ }
+
+ if (dr[drCur] && timeInt >= dr[drCur][0] && timeInt < dr[drCur][1]) {
+ if (settings.useSelect) {
+ row.prop('disabled', true);
+ } else {
+ row.addClass('ui-timepicker-disabled');
+ }
+ }
+ }
+
+ list.append(row);
+ }
+
+ wrapped_list.data('timepicker-input', self);
+ self.data('timepicker-list', wrapped_list);
+
+ if (settings.useSelect) {
+ if (self.val()) {
+ list.val(_roundAndFormatTime(_time2int(self.val()), settings));
+ }
+
+ list.on('focus', function(){
+ $(this).data('timepicker-input').trigger('showTimepicker');
+ });
+ list.on('blur', function(){
+ $(this).data('timepicker-input').trigger('hideTimepicker');
+ });
+ list.on('change', function(){
+ _setTimeValue(self, $(this).val(), 'select');
+ });
+
+ _setTimeValue(self, list.val(), 'initial');
+ self.hide().after(list);
+ } else {
+ var appendTo = settings.appendTo;
+ if (typeof appendTo === 'string') {
+ appendTo = $(appendTo);
+ } else if (typeof appendTo === 'function') {
+ appendTo = appendTo(self);
+ }
+ appendTo.append(wrapped_list);
+ _setSelected(self, list);
+
+ list.on('mousedown click', 'li', function(e) {
+
+ // hack: temporarily disable the focus handler
+ // to deal with the fact that IE fires 'focus'
+ // events asynchronously
+ self.off('focus.timepicker');
+ self.on('focus.timepicker-ie-hack', function(){
+ self.off('focus.timepicker-ie-hack');
+ self.on('focus.timepicker', methods.show);
+ });
+
+ if (!_hideKeyboard(self)) {
+ self[0].focus();
+ }
+
+ // make sure only the clicked row is selected
+ list.find('li').removeClass('ui-timepicker-selected');
+ $(this).addClass('ui-timepicker-selected');
+
+ if (_selectValue(self)) {
+ self.trigger('hideTimepicker');
+
+ list.on('mouseup.timepicker click.timepicker', 'li', function(e) {
+ list.off('mouseup.timepicker click.timepicker');
+ wrapped_list.hide();
+ });
+ }
+ });
+ }
+ }
+
+ function _generateNoneElement(optionValue, useSelect)
+ {
+ var label, className, value;
+
+ if (typeof optionValue == 'object') {
+ label = optionValue.label;
+ className = optionValue.className;
+ value = optionValue.value;
+ } else if (typeof optionValue == 'string') {
+ label = optionValue;
+ } else {
+ $.error('Invalid noneOption value');
+ }
+
+ if (useSelect) {
+ return $('<option />', {
+ 'value': value,
+ 'class': className,
+ 'text': label
+ });
+ } else {
+ return $('<li />', {
+ 'class': className,
+ 'text': label
+ }).data('time', String(value));
+ }
+ }
+
+ function _roundAndFormatTime(seconds, settings)
+ {
+ seconds = settings.roundingFunction(seconds, settings);
+ if (seconds !== null) {
+ return _int2time(seconds, settings);
+ }
+ }
+
+ // event handler to decide whether to close timepicker
+ function _closeHandler(e)
+ {
+ if (e.target == window) {
+ // mobile Chrome fires focus events against window for some reason
+ return;
+ }
+
+ var target = $(e.target);
+
+ if (target.closest('.ui-timepicker-input').length || target.closest('.ui-timepicker-wrapper').length) {
+ // active timepicker was focused. ignore
+ return;
+ }
+
+ methods.hide();
+ $(document).unbind('.ui-timepicker');
+ $(window).unbind('.ui-timepicker');
+ }
+
+ function _hideKeyboard(self)
+ {
+ var settings = self.data('timepicker-settings');
+ return ((window.navigator.msMaxTouchPoints || 'ontouchstart' in document) && settings.disableTouchKeyboard);
+ }
+
+ function _findRow(self, list, value)
+ {
+ if (!value && value !== 0) {
+ return false;
+ }
+
+ var settings = self.data('timepicker-settings');
+ var out = false;
+ var value = settings.roundingFunction(value, settings);
+
+ // loop through the menu items
+ list.find('li').each(function(i, obj) {
+ var jObj = $(obj);
+ if (typeof jObj.data('time') != 'number') {
+ return;
+ }
+
+ if (jObj.data('time') == value) {
+ out = jObj;
+ return false;
+ }
+ });
+
+ return out;
+ }
+
+ function _setSelected(self, list)
+ {
+ list.find('li').removeClass('ui-timepicker-selected');
+
+ var timeValue = _time2int(_getTimeValue(self), self.data('timepicker-settings'));
+ if (timeValue === null) {
+ return;
+ }
+
+ var selected = _findRow(self, list, timeValue);
+ if (selected) {
+
+ var topDelta = selected.offset().top - list.offset().top;
+
+ if (topDelta + selected.outerHeight() > list.outerHeight() || topDelta < 0) {
+ list.scrollTop(list.scrollTop() + selected.position().top - selected.outerHeight());
+ }
+
+ selected.addClass('ui-timepicker-selected');
+ }
+ }
+
+
+ function _formatValue(e, origin)
+ {
+ if (this.value === '' || origin == 'timepicker') {
+ return;
+ }
+
+ var self = $(this);
+
+ if (self.is(':focus') && (!e || e.type != 'change')) {
+ return;
+ }
+
+ var settings = self.data('timepicker-settings');
+ var seconds = _time2int(this.value, settings);
+
+ if (seconds === null) {
+ self.trigger('timeFormatError');
+ return;
+ }
+
+ var rangeError = false;
+ // check that the time in within bounds
+ if (settings.minTime !== null && seconds < settings.minTime
+ && settings.maxTime !== null && seconds > settings.maxTime) {
+ rangeError = true;
+ }
+
+ // check that time isn't within disabled time ranges
+ $.each(settings.disableTimeRanges, function(){
+ if (seconds >= this[0] && seconds < this[1]) {
+ rangeError = true;
+ return false;
+ }
+ });
+
+ if (settings.forceRoundTime) {
+ seconds = settings.roundingFunction(seconds, settings);
+ }
+
+ var prettyTime = _int2time(seconds, settings);
+
+ if (rangeError) {
+ if (_setTimeValue(self, prettyTime, 'error')) {
+ self.trigger('timeRangeError');
+ }
+ } else {
+ _setTimeValue(self, prettyTime);
+ }
+ }
+
+ function _getTimeValue(self)
+ {
+ if (self.is('input')) {
+ return self.val();
+ } else {
+ // use the element's data attributes to store values
+ return self.data('ui-timepicker-value');
+ }
+ }
+
+ function _setTimeValue(self, value, source)
+ {
+ if (self.is('input')) {
+ self.val(value);
+
+ var settings = self.data('timepicker-settings');
+ if (settings.useSelect && source != 'select' && source != 'initial') {
+ self.data('timepicker-list').val(_roundAndFormatTime(_time2int(value), settings));
+ }
+ }
+
+ if (self.data('ui-timepicker-value') != value) {
+ self.data('ui-timepicker-value', value);
+ if (source == 'select') {
+ self.trigger('selectTime').trigger('changeTime').trigger('change', 'timepicker');
+ } else if (source != 'error') {
+ self.trigger('changeTime');
+ }
+
+ return true;
+ } else {
+ self.trigger('selectTime');
+ return false;
+ }
+ }
+
+ /*
+ * Filter freeform input
+ */
+ function _disableTextInputHandler(e)
+ {
+ switch (e.keyCode) {
+ case 13: // return
+ case 9: //tab
+ return;
+
+ default:
+ e.preventDefault();
+ }
+ }
+
+ /*
+ * Keyboard navigation via arrow keys
+ */
+ function _keydownhandler(e)
+ {
+ var self = $(this);
+ var list = self.data('timepicker-list');
+
+ if (!list || !_isVisible(list)) {
+ if (e.keyCode == 40) {
+ // show the list!
+ methods.show.call(self.get(0));
+ list = self.data('timepicker-list');
+ if (!_hideKeyboard(self)) {
+ self.focus();
+ }
+ } else {
+ return true;
+ }
+ }
+
+ switch (e.keyCode) {
+
+ case 13: // return
+ if (_selectValue(self)) {
+ methods.hide.apply(this);
+ }
+
+ e.preventDefault();
+ return false;
+
+ case 38: // up
+ var selected = list.find('.ui-timepicker-selected');
+
+ if (!selected.length) {
+ list.find('li').each(function(i, obj) {
+ if ($(obj).position().top > 0) {
+ selected = $(obj);
+ return false;
+ }
+ });
+ selected.addClass('ui-timepicker-selected');
+
+ } else if (!selected.is(':first-child')) {
+ selected.removeClass('ui-timepicker-selected');
+ selected.prev().addClass('ui-timepicker-selected');
+
+ if (selected.prev().position().top < selected.outerHeight()) {
+ list.scrollTop(list.scrollTop() - selected.outerHeight());
+ }
+ }
+
+ return false;
+
+ case 40: // down
+ selected = list.find('.ui-timepicker-selected');
+
+ if (selected.length === 0) {
+ list.find('li').each(function(i, obj) {
+ if ($(obj).position().top > 0) {
+ selected = $(obj);
+ return false;
+ }
+ });
+
+ selected.addClass('ui-timepicker-selected');
+ } else if (!selected.is(':last-child')) {
+ selected.removeClass('ui-timepicker-selected');
+ selected.next().addClass('ui-timepicker-selected');
+
+ if (selected.next().position().top + 2*selected.outerHeight() > list.outerHeight()) {
+ list.scrollTop(list.scrollTop() + selected.outerHeight());
+ }
+ }
+
+ return false;
+
+ case 27: // escape
+ list.find('li').removeClass('ui-timepicker-selected');
+ methods.hide();
+ break;
+
+ case 9: //tab
+ methods.hide();
+ break;
+
+ default:
+ return true;
+ }
+ }
+
+ /*
+ * Time typeahead
+ */
+ function _keyuphandler(e)
+ {
+ var self = $(this);
+ var list = self.data('timepicker-list');
+ var settings = self.data('timepicker-settings');
+
+ if (!list || !_isVisible(list) || settings.disableTextInput) {
+ return true;
+ }
+
+ switch (e.keyCode) {
+
+ case 96: // numpad numerals
+ case 97:
+ case 98:
+ case 99:
+ case 100:
+ case 101:
+ case 102:
+ case 103:
+ case 104:
+ case 105:
+ case 48: // numerals
+ case 49:
+ case 50:
+ case 51:
+ case 52:
+ case 53:
+ case 54:
+ case 55:
+ case 56:
+ case 57:
+ case 65: // a
+ case 77: // m
+ case 80: // p
+ case 186: // colon
+ case 8: // backspace
+ case 46: // delete
+ if (settings.typeaheadHighlight) {
+ _setSelected(self, list);
+ } else {
+ list.hide();
+ }
+ break;
+ }
+ }
+
+ function _selectValue(self)
+ {
+ var settings = self.data('timepicker-settings');
+ var list = self.data('timepicker-list');
+ var timeValue = null;
+
+ var cursor = list.find('.ui-timepicker-selected');
+
+ if (cursor.hasClass('ui-timepicker-disabled')) {
+ return false;
+ }
+
+ if (cursor.length) {
+ // selected value found
+ timeValue = cursor.data('time');
+ }
+
+ if (timeValue !== null) {
+ if (typeof timeValue != 'string') {
+ timeValue = _int2time(timeValue, settings);
+ }
+
+ _setTimeValue(self, timeValue, 'select');
+ }
+
+ return true;
+ }
+
+ function _int2duration(seconds, step)
+ {
+ seconds = Math.abs(seconds);
+ var minutes = Math.round(seconds/60),
+ duration = [],
+ hours, mins;
+
+ if (minutes < 60) {
+ // Only show (x mins) under 1 hour
+ duration = [minutes, _lang.mins];
+ } else {
+ hours = Math.floor(minutes/60);
+ mins = minutes%60;
+
+ // Show decimal notation (eg: 1.5 hrs) for 30 minute steps
+ if (step == 30 && mins == 30) {
+ hours += _lang.decimal + 5;
+ }
+
+ duration.push(hours);
+ duration.push(hours == 1 ? _lang.hr : _lang.hrs);
+
+ // Show remainder minutes notation (eg: 1 hr 15 mins) for non-30 minute steps
+ // and only if there are remainder minutes to show
+ if (step != 30 && mins) {
+ duration.push(mins);
+ duration.push(_lang.mins);
+ }
+ }
+
+ return duration.join(' ');
+ }
+
+ function _int2time(timeInt, settings)
+ {
+ if (typeof timeInt != 'number') {
+ return null;
+ }
+
+ var seconds = parseInt(timeInt%60)
+ , minutes = parseInt((timeInt/60)%60)
+ , hours = parseInt((timeInt/(60*60))%24);
+
+ var time = new Date(1970, 0, 2, hours, minutes, seconds, 0);
+
+ if (isNaN(time.getTime())) {
+ return null;
+ }
+
+ if ($.type(settings.timeFormat) === "function") {
+ return settings.timeFormat(time);
+ }
+
+ var output = '';
+ var hour, code;
+ for (var i=0; i<settings.timeFormat.length; i++) {
+
+ code = settings.timeFormat.charAt(i);
+ switch (code) {
+
+ case 'a':
+ output += (time.getHours() > 11) ? _lang.pm : _lang.am;
+ break;
+
+ case 'A':
+ output += (time.getHours() > 11) ? _lang.PM : _lang.AM;
+ break;
+
+ case 'g':
+ hour = time.getHours() % 12;
+ output += (hour === 0) ? '12' : hour;
+ break;
+
+ case 'G':
+ hour = time.getHours();
+ if (timeInt === _ONE_DAY) hour = settings.show2400 ? 24 : 0;
+ output += hour;
+ break;
+
+ case 'h':
+ hour = time.getHours() % 12;
+
+ if (hour !== 0 && hour < 10) {
+ hour = '0'+hour;
+ }
+
+ output += (hour === 0) ? '12' : hour;
+ break;
+
+ case 'H':
+ hour = time.getHours();
+ if (timeInt === _ONE_DAY) hour = settings.show2400 ? 24 : 0;
+ output += (hour > 9) ? hour : '0'+hour;
+ break;
+
+ case 'i':
+ var minutes = time.getMinutes();
+ output += (minutes > 9) ? minutes : '0'+minutes;
+ break;
+
+ case 's':
+ seconds = time.getSeconds();
+ output += (seconds > 9) ? seconds : '0'+seconds;
+ break;
+
+ case '\\':
+ // escape character; add the next character and skip ahead
+ i++;
+ output += settings.timeFormat.charAt(i);
+ break;
+
+ default:
+ output += code;
+ }
+ }
+
+ return output;
+ }
+
+ function _time2int(timeString, settings)
+ {
+ if (timeString === '' || timeString === null) return null;
+ if (typeof timeString == 'object') {
+ return timeString.getHours()*3600 + timeString.getMinutes()*60 + timeString.getSeconds();
+ }
+ if (typeof timeString != 'string') {
+ return timeString;
+ }
+
+ timeString = timeString.toLowerCase().replace(/[\s\.]/g, '');
+
+ // if the last character is an "a" or "p", add the "m"
+ if (timeString.slice(-1) == 'a' || timeString.slice(-1) == 'p') {
+ timeString += 'm';
+ }
+
+ var ampmRegex = '(' +
+ _lang.am.replace('.', '')+'|' +
+ _lang.pm.replace('.', '')+'|' +
+ _lang.AM.replace('.', '')+'|' +
+ _lang.PM.replace('.', '')+')?';
+
+ // try to parse time input
+ var pattern = new RegExp('^'+ampmRegex+'([0-9]?[0-9])\\W?([0-5][0-9])?\\W?([0-5][0-9])?'+ampmRegex+'$');
+
+ var time = timeString.match(pattern);
+ if (!time) {
+ return null;
+ }
+
+ var hour = parseInt(time[2]*1, 10);
+ if (hour > 24) {
+ if (settings && settings.wrapHours === false) {
+ return null;
+ } else {
+ hour = hour % 24;
+ }
+ }
+
+ var ampm = time[1] || time[5];
+ var hours = hour;
+
+ if (hour <= 12 && ampm) {
+ var isPm = (ampm == _lang.pm || ampm == _lang.PM);
+
+ if (hour == 12) {
+ hours = isPm ? 12 : 0;
+ } else {
+ hours = (hour + (isPm ? 12 : 0));
+ }
+ }
+
+ var minutes = ( time[3]*1 || 0 );
+ var seconds = ( time[4]*1 || 0 );
+ var timeInt = hours*3600 + minutes*60 + seconds;
+
+ // if no am/pm provided, intelligently guess based on the scrollDefault
+ if (hour < 12 && !ampm && settings && settings._twelveHourTime && settings.scrollDefault) {
+ var delta = timeInt - settings.scrollDefault();
+ if (delta < 0 && delta >= _ONE_DAY / -2) {
+ timeInt = (timeInt + (_ONE_DAY / 2)) % _ONE_DAY;
+ }
+ }
+
+ return timeInt;
+ }
+
+ function _pad2(n) {
+ return ("0" + n).slice(-2);
+ }
+
+ // Plugin entry
+ $.fn.timepicker = function(method)
+ {
+ if (!this.length) return this;
+ if (methods[method]) {
+ // check if this element is a timepicker
+ if (!this.hasClass('ui-timepicker-input')) {
+ return this;
+ }
+ return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
+ }
+ else if(typeof method === "object" || !method) { return methods.init.apply(this, arguments); }
+ else { $.error("Method "+ method + " does not exist on jQuery.timepicker"); }
+ };
+ // Global defaults
+ $.fn.timepicker.defaults = {
+ appendTo: 'body',
+ className: null,
+ closeOnWindowScroll: false,
+ disableTextInput: false,
+ disableTimeRanges: [],
+ disableTouchKeyboard: false,
+ durationTime: null,
+ forceRoundTime: false,
+ maxTime: null,
+ minTime: null,
+ noneOption: false,
+ orientation: 'l',
+ roundingFunction: function(seconds, settings) {
+ if (seconds === null) {
+ return null;
+ } else if (typeof settings.step !== "number") {
+ // TODO: nearest fit irregular steps
+ return seconds;
+ } else {
+ var offset = seconds % (settings.step*60); // step is in minutes
+
+ if (offset >= settings.step*30) {
+ // if offset is larger than a half step, round up
+ seconds += (settings.step*60) - offset;
+ } else {
+ // round down
+ seconds -= offset;
+ }
+
+ if (seconds == _ONE_DAY && settings.show2400) {
+ return seconds;
+ }
+
+ return seconds%_ONE_DAY;
+ }
+ },
+ scrollDefault: null,
+ selectOnBlur: false,
+ show2400: false,
+ showDuration: false,
+ showOn: ['click', 'focus'],
+ showOnFocus: true,
+ step: 30,
+ stopScrollPropagation: false,
+ timeFormat: 'g:ia',
+ typeaheadHighlight: true,
+ useSelect: false,
+ wrapHours: true
+ };
+}));
--- /dev/null
+/*!
+ * jquery-timepicker v1.11.1 - A jQuery timepicker plugin inspired by Google Calendar. It supports both mouse and keyboard navigation.
+ * Copyright (c) 2016 Jon Thornton - http://jonthornton.github.com/jquery-timepicker/
+ * License: MIT
+ */
+
+!function(a){"object"==typeof exports&&exports&&"object"==typeof module&&module&&module.exports===exports?a(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){function b(a){var b=a[0];return b.offsetWidth>0&&b.offsetHeight>0}function c(b){if(b.minTime&&(b.minTime=t(b.minTime)),b.maxTime&&(b.maxTime=t(b.maxTime)),b.durationTime&&"function"!=typeof b.durationTime&&(b.durationTime=t(b.durationTime)),"now"==b.scrollDefault)b.scrollDefault=function(){return b.roundingFunction(t(new Date),b)};else if(b.scrollDefault&&"function"!=typeof b.scrollDefault){var c=b.scrollDefault;b.scrollDefault=function(){return b.roundingFunction(t(c),b)}}else b.minTime&&(b.scrollDefault=function(){return b.roundingFunction(b.minTime,b)});if("string"===a.type(b.timeFormat)&&b.timeFormat.match(/[gh]/)&&(b._twelveHourTime=!0),b.showOnFocus===!1&&-1!=b.showOn.indexOf("focus")&&b.showOn.splice(b.showOn.indexOf("focus"),1),b.disableTimeRanges.length>0){for(var d in b.disableTimeRanges)b.disableTimeRanges[d]=[t(b.disableTimeRanges[d][0]),t(b.disableTimeRanges[d][1])];b.disableTimeRanges=b.disableTimeRanges.sort(function(a,b){return a[0]-b[0]});for(var d=b.disableTimeRanges.length-1;d>0;d--)b.disableTimeRanges[d][0]<=b.disableTimeRanges[d-1][1]&&(b.disableTimeRanges[d-1]=[Math.min(b.disableTimeRanges[d][0],b.disableTimeRanges[d-1][0]),Math.max(b.disableTimeRanges[d][1],b.disableTimeRanges[d-1][1])],b.disableTimeRanges.splice(d,1))}return b}function d(b){var c=b.data("timepicker-settings"),d=b.data("timepicker-list");if(d&&d.length&&(d.remove(),b.data("timepicker-list",!1)),c.useSelect){d=a("<select />",{"class":"ui-timepicker-select"});var g=d}else{d=a("<ul />",{"class":"ui-timepicker-list"});var g=a("<div />",{"class":"ui-timepicker-wrapper",tabindex:-1});g.css({display:"none",position:"absolute"}).append(d)}if(c.noneOption)if(c.noneOption===!0&&(c.noneOption=c.useSelect?"Time...":"None"),a.isArray(c.noneOption)){for(var i in c.noneOption)if(parseInt(i,10)==i){var k=e(c.noneOption[i],c.useSelect);d.append(k)}}else{var k=e(c.noneOption,c.useSelect);d.append(k)}if(c.className&&g.addClass(c.className),(null!==c.minTime||null!==c.durationTime)&&c.showDuration){"function"==typeof c.step?"function":c.step;g.addClass("ui-timepicker-with-duration"),g.addClass("ui-timepicker-step-"+c.step)}var l=c.minTime;"function"==typeof c.durationTime?l=t(c.durationTime()):null!==c.durationTime&&(l=c.durationTime);var n=null!==c.minTime?c.minTime:0,o=null!==c.maxTime?c.maxTime:n+u-1;n>o&&(o+=u),o===u-1&&"string"===a.type(c.timeFormat)&&c.show2400&&(o=u);var p=c.disableTimeRanges,v=0,x=p.length,y=c.step;"function"!=typeof y&&(y=function(){return c.step});for(var i=n,z=0;o>=i;z++,i+=60*y(z)){var A=i,B=s(A,c);if(c.useSelect){var C=a("<option />",{value:B});C.text(B)}else{var C=a("<li />");C.addClass(43200>A%86400?"ui-timepicker-am":"ui-timepicker-pm"),C.data("time",86400>=A?A:A%86400),C.text(B)}if((null!==c.minTime||null!==c.durationTime)&&c.showDuration){var D=r(i-l,c.step);if(c.useSelect)C.text(C.text()+" ("+D+")");else{var E=a("<span />",{"class":"ui-timepicker-duration"});E.text(" ("+D+")"),C.append(E)}}x>v&&(A>=p[v][1]&&(v+=1),p[v]&&A>=p[v][0]&&A<p[v][1]&&(c.useSelect?C.prop("disabled",!0):C.addClass("ui-timepicker-disabled"))),d.append(C)}if(g.data("timepicker-input",b),b.data("timepicker-list",g),c.useSelect)b.val()&&d.val(f(t(b.val()),c)),d.on("focus",function(){a(this).data("timepicker-input").trigger("showTimepicker")}),d.on("blur",function(){a(this).data("timepicker-input").trigger("hideTimepicker")}),d.on("change",function(){m(b,a(this).val(),"select")}),m(b,d.val(),"initial"),b.hide().after(d);else{var F=c.appendTo;"string"==typeof F?F=a(F):"function"==typeof F&&(F=F(b)),F.append(g),j(b,d),d.on("mousedown click","li",function(c){b.off("focus.timepicker"),b.on("focus.timepicker-ie-hack",function(){b.off("focus.timepicker-ie-hack"),b.on("focus.timepicker",w.show)}),h(b)||b[0].focus(),d.find("li").removeClass("ui-timepicker-selected"),a(this).addClass("ui-timepicker-selected"),q(b)&&(b.trigger("hideTimepicker"),d.on("mouseup.timepicker click.timepicker","li",function(a){d.off("mouseup.timepicker click.timepicker"),g.hide()}))})}}function e(b,c){var d,e,f;return"object"==typeof b?(d=b.label,e=b.className,f=b.value):"string"==typeof b?d=b:a.error("Invalid noneOption value"),c?a("<option />",{value:f,"class":e,text:d}):a("<li />",{"class":e,text:d}).data("time",String(f))}function f(a,b){return a=b.roundingFunction(a,b),null!==a?s(a,b):void 0}function g(b){if(b.target!=window){var c=a(b.target);c.closest(".ui-timepicker-input").length||c.closest(".ui-timepicker-wrapper").length||(w.hide(),a(document).unbind(".ui-timepicker"),a(window).unbind(".ui-timepicker"))}}function h(a){var b=a.data("timepicker-settings");return(window.navigator.msMaxTouchPoints||"ontouchstart"in document)&&b.disableTouchKeyboard}function i(b,c,d){if(!d&&0!==d)return!1;var e=b.data("timepicker-settings"),f=!1,d=e.roundingFunction(d,e);return c.find("li").each(function(b,c){var e=a(c);if("number"==typeof e.data("time"))return e.data("time")==d?(f=e,!1):void 0}),f}function j(a,b){b.find("li").removeClass("ui-timepicker-selected");var c=t(l(a),a.data("timepicker-settings"));if(null!==c){var d=i(a,b,c);if(d){var e=d.offset().top-b.offset().top;(e+d.outerHeight()>b.outerHeight()||0>e)&&b.scrollTop(b.scrollTop()+d.position().top-d.outerHeight()),d.addClass("ui-timepicker-selected")}}}function k(b,c){if(""!==this.value&&"timepicker"!=c){var d=a(this);if(!d.is(":focus")||b&&"change"==b.type){var e=d.data("timepicker-settings"),f=t(this.value,e);if(null===f)return void d.trigger("timeFormatError");var g=!1;null!==e.minTime&&f<e.minTime&&null!==e.maxTime&&f>e.maxTime&&(g=!0),a.each(e.disableTimeRanges,function(){return f>=this[0]&&f<this[1]?(g=!0,!1):void 0}),e.forceRoundTime&&(f=e.roundingFunction(f,e));var h=s(f,e);g?m(d,h,"error")&&d.trigger("timeRangeError"):m(d,h)}}}function l(a){return a.is("input")?a.val():a.data("ui-timepicker-value")}function m(a,b,c){if(a.is("input")){a.val(b);var d=a.data("timepicker-settings");d.useSelect&&"select"!=c&&"initial"!=c&&a.data("timepicker-list").val(f(t(b),d))}return a.data("ui-timepicker-value")!=b?(a.data("ui-timepicker-value",b),"select"==c?a.trigger("selectTime").trigger("changeTime").trigger("change","timepicker"):"error"!=c&&a.trigger("changeTime"),!0):(a.trigger("selectTime"),!1)}function n(a){switch(a.keyCode){case 13:case 9:return;default:a.preventDefault()}}function o(c){var d=a(this),e=d.data("timepicker-list");if(!e||!b(e)){if(40!=c.keyCode)return!0;w.show.call(d.get(0)),e=d.data("timepicker-list"),h(d)||d.focus()}switch(c.keyCode){case 13:return q(d)&&w.hide.apply(this),c.preventDefault(),!1;case 38:var f=e.find(".ui-timepicker-selected");return f.length?f.is(":first-child")||(f.removeClass("ui-timepicker-selected"),f.prev().addClass("ui-timepicker-selected"),f.prev().position().top<f.outerHeight()&&e.scrollTop(e.scrollTop()-f.outerHeight())):(e.find("li").each(function(b,c){return a(c).position().top>0?(f=a(c),!1):void 0}),f.addClass("ui-timepicker-selected")),!1;case 40:return f=e.find(".ui-timepicker-selected"),0===f.length?(e.find("li").each(function(b,c){return a(c).position().top>0?(f=a(c),!1):void 0}),f.addClass("ui-timepicker-selected")):f.is(":last-child")||(f.removeClass("ui-timepicker-selected"),f.next().addClass("ui-timepicker-selected"),f.next().position().top+2*f.outerHeight()>e.outerHeight()&&e.scrollTop(e.scrollTop()+f.outerHeight())),!1;case 27:e.find("li").removeClass("ui-timepicker-selected"),w.hide();break;case 9:w.hide();break;default:return!0}}function p(c){var d=a(this),e=d.data("timepicker-list"),f=d.data("timepicker-settings");if(!e||!b(e)||f.disableTextInput)return!0;switch(c.keyCode){case 96:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 65:case 77:case 80:case 186:case 8:case 46:f.typeaheadHighlight?j(d,e):e.hide()}}function q(a){var b=a.data("timepicker-settings"),c=a.data("timepicker-list"),d=null,e=c.find(".ui-timepicker-selected");return e.hasClass("ui-timepicker-disabled")?!1:(e.length&&(d=e.data("time")),null!==d&&("string"!=typeof d&&(d=s(d,b)),m(a,d,"select")),!0)}function r(a,b){a=Math.abs(a);var c,d,e=Math.round(a/60),f=[];return 60>e?f=[e,v.mins]:(c=Math.floor(e/60),d=e%60,30==b&&30==d&&(c+=v.decimal+5),f.push(c),f.push(1==c?v.hr:v.hrs),30!=b&&d&&(f.push(d),f.push(v.mins))),f.join(" ")}function s(b,c){if("number"!=typeof b)return null;var d=parseInt(b%60),e=parseInt(b/60%60),f=parseInt(b/3600%24),g=new Date(1970,0,2,f,e,d,0);if(isNaN(g.getTime()))return null;if("function"===a.type(c.timeFormat))return c.timeFormat(g);for(var h,i,j="",k=0;k<c.timeFormat.length;k++)switch(i=c.timeFormat.charAt(k)){case"a":j+=g.getHours()>11?v.pm:v.am;break;case"A":j+=g.getHours()>11?v.PM:v.AM;break;case"g":h=g.getHours()%12,j+=0===h?"12":h;break;case"G":h=g.getHours(),b===u&&(h=c.show2400?24:0),j+=h;break;case"h":h=g.getHours()%12,0!==h&&10>h&&(h="0"+h),j+=0===h?"12":h;break;case"H":h=g.getHours(),b===u&&(h=c.show2400?24:0),j+=h>9?h:"0"+h;break;case"i":var e=g.getMinutes();j+=e>9?e:"0"+e;break;case"s":d=g.getSeconds(),j+=d>9?d:"0"+d;break;case"\\":k++,j+=c.timeFormat.charAt(k);break;default:j+=i}return j}function t(a,b){if(""===a||null===a)return null;if("object"==typeof a)return 3600*a.getHours()+60*a.getMinutes()+a.getSeconds();if("string"!=typeof a)return a;a=a.toLowerCase().replace(/[\s\.]/g,""),("a"==a.slice(-1)||"p"==a.slice(-1))&&(a+="m");var c="("+v.am.replace(".","")+"|"+v.pm.replace(".","")+"|"+v.AM.replace(".","")+"|"+v.PM.replace(".","")+")?",d=new RegExp("^"+c+"([0-9]?[0-9])\\W?([0-5][0-9])?\\W?([0-5][0-9])?"+c+"$"),e=a.match(d);if(!e)return null;var f=parseInt(1*e[2],10);if(f>24){if(b&&b.wrapHours===!1)return null;f%=24}var g=e[1]||e[5],h=f;if(12>=f&&g){var i=g==v.pm||g==v.PM;h=12==f?i?12:0:f+(i?12:0)}var j=1*e[3]||0,k=1*e[4]||0,l=3600*h+60*j+k;if(12>f&&!g&&b&&b._twelveHourTime&&b.scrollDefault){var m=l-b.scrollDefault();0>m&&m>=u/-2&&(l=(l+u/2)%u)}return l}var u=86400,v={am:"am",pm:"pm",AM:"AM",PM:"PM",decimal:".",mins:"mins",hr:"hr",hrs:"hrs"},w={init:function(b){return this.each(function(){var e=a(this),f=[];for(var g in a.fn.timepicker.defaults)e.data(g)&&(f[g]=e.data(g));var h=a.extend({},a.fn.timepicker.defaults,f,b);if(h.lang&&(v=a.extend(v,h.lang)),h=c(h),e.data("timepicker-settings",h),e.addClass("ui-timepicker-input"),h.useSelect)d(e);else{if(e.prop("autocomplete","off"),h.showOn)for(var i in h.showOn)e.on(h.showOn[i]+".timepicker",w.show);e.on("change.timepicker",k),e.on("keydown.timepicker",o),e.on("keyup.timepicker",p),h.disableTextInput&&e.on("keydown.timepicker",n),k.call(e.get(0))}})},show:function(c){var e=a(this),f=e.data("timepicker-settings");if(c&&c.preventDefault(),f.useSelect)return void e.data("timepicker-list").focus();h(e)&&e.blur();var k=e.data("timepicker-list");if(!e.prop("readonly")&&(k&&0!==k.length&&"function"!=typeof f.durationTime||(d(e),k=e.data("timepicker-list")),!b(k))){e.data("ui-timepicker-value",e.val()),j(e,k),w.hide(),k.show();var m={};f.orientation.match(/r/)?m.left=e.offset().left+e.outerWidth()-k.outerWidth()+parseInt(k.css("marginLeft").replace("px",""),10):m.left=e.offset().left+parseInt(k.css("marginLeft").replace("px",""),10);var n;n=f.orientation.match(/t/)?"t":f.orientation.match(/b/)?"b":e.offset().top+e.outerHeight(!0)+k.outerHeight()>a(window).height()+a(window).scrollTop()?"t":"b","t"==n?(k.addClass("ui-timepicker-positioned-top"),m.top=e.offset().top-k.outerHeight()+parseInt(k.css("marginTop").replace("px",""),10)):(k.removeClass("ui-timepicker-positioned-top"),m.top=e.offset().top+e.outerHeight()+parseInt(k.css("marginTop").replace("px",""),10)),k.offset(m);var o=k.find(".ui-timepicker-selected");if(!o.length){var p=t(l(e));null!==p?o=i(e,k,p):f.scrollDefault&&(o=i(e,k,f.scrollDefault()))}if(o&&o.length){var q=k.scrollTop()+o.position().top-o.outerHeight();k.scrollTop(q)}else k.scrollTop(0);return f.stopScrollPropagation&&a(document).on("wheel.ui-timepicker",".ui-timepicker-wrapper",function(b){b.preventDefault();var c=a(this).scrollTop();a(this).scrollTop(c+b.originalEvent.deltaY)}),a(document).on("touchstart.ui-timepicker mousedown.ui-timepicker",g),a(window).on("resize.ui-timepicker",g),f.closeOnWindowScroll&&a(document).on("scroll.ui-timepicker",g),e.trigger("showTimepicker"),this}},hide:function(c){var d=a(this),e=d.data("timepicker-settings");return e&&e.useSelect&&d.blur(),a(".ui-timepicker-wrapper").each(function(){var c=a(this);if(b(c)){var d=c.data("timepicker-input"),e=d.data("timepicker-settings");e&&e.selectOnBlur&&q(d),c.hide(),d.trigger("hideTimepicker")}}),this},option:function(b,e){return"string"==typeof b&&"undefined"==typeof e?a(this).data("timepicker-settings")[b]:this.each(function(){var f=a(this),g=f.data("timepicker-settings"),h=f.data("timepicker-list");"object"==typeof b?g=a.extend(g,b):"string"==typeof b&&(g[b]=e),g=c(g),f.data("timepicker-settings",g),h&&(h.remove(),f.data("timepicker-list",!1)),g.useSelect&&d(f)})},getSecondsFromMidnight:function(){return t(l(this))},getTime:function(a){var b=this,c=l(b);if(!c)return null;var d=t(c);if(null===d)return null;a||(a=new Date);var e=new Date(a);return e.setHours(d/3600),e.setMinutes(d%3600/60),e.setSeconds(d%60),e.setMilliseconds(0),e},isVisible:function(){var a=this,c=a.data("timepicker-list");return!(!c||!b(c))},setTime:function(a){var b=this,c=b.data("timepicker-settings");if(c.forceRoundTime)var d=f(t(a),c);else var d=s(t(a),c);return a&&null===d&&c.noneOption&&(d=a),m(b,d),b.data("timepicker-list")&&j(b,b.data("timepicker-list")),this},remove:function(){var a=this;if(a.hasClass("ui-timepicker-input")){var b=a.data("timepicker-settings");return a.removeAttr("autocomplete","off"),a.removeClass("ui-timepicker-input"),a.removeData("timepicker-settings"),a.off(".timepicker"),a.data("timepicker-list")&&a.data("timepicker-list").remove(),b.useSelect&&a.show(),a.removeData("timepicker-list"),this}}};a.fn.timepicker=function(b){return this.length?w[b]?this.hasClass("ui-timepicker-input")?w[b].apply(this,Array.prototype.slice.call(arguments,1)):this:"object"!=typeof b&&b?void a.error("Method "+b+" does not exist on jQuery.timepicker"):w.init.apply(this,arguments):this},a.fn.timepicker.defaults={appendTo:"body",className:null,closeOnWindowScroll:!1,disableTextInput:!1,disableTimeRanges:[],disableTouchKeyboard:!1,durationTime:null,forceRoundTime:!1,maxTime:null,minTime:null,noneOption:!1,orientation:"l",roundingFunction:function(a,b){if(null===a)return null;if("number"!=typeof b.step)return a;var c=a%(60*b.step);return c>=30*b.step?a+=60*b.step-c:a-=c,a==u&&b.show2400?a:a%u},scrollDefault:null,selectOnBlur:!1,show2400:!1,showDuration:!1,showOn:["click","focus"],showOnFocus:!0,step:30,stopScrollPropagation:!1,timeFormat:"g:ia",typeaheadHighlight:!0,useSelect:!1,wrapHours:!0}});
\ No newline at end of file
--- /dev/null
+{
+ "name": "jt.timepicker",
+ "version": "1.6.0",
+ "title": "jquery-timepicker",
+ "description": "A jQuery timepicker plugin inspired by Google Calendar. It supports both mouse and keyboard navigation.",
+ "author": {
+ "name": "Jon Thornton",
+ "email": "thornton.jon@gmail.com",
+ "url": "https://github.com/jonthornton"
+ },
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "MIT-LICENSE.txt"
+ }
+ ],
+ "dependencies": {
+ "jquery": ">=1.7"
+ },
+ "keywords": [ "timepicker", "time", "picker", "ui", "calendar", "input", "form" ],
+ "homepage": "http://jonthornton.github.com/jquery-timepicker/",
+ "bugs": {
+ "url": "https://github.com/jonthornton/jquery-timepicker/issues"
+ },
+ "docs": "https://github.com/jonthornton/jquery-timepicker",
+ "download": "https://github.com/jonthornton/jquery-timepicker"
+}
--- /dev/null
+/*!
+ * Datepicker for Bootstrap
+ *
+ * Copyright 2012 Stefan Petre
+ * Improvements by Andrew Rowls
+ * Licensed under the Apache License v2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+.datepicker {
+ padding: 4px;
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
+ direction: ltr;
+ /*.dow {
+ border-top: 1px solid #ddd !important;
+ }*/
+}
+.datepicker-inline {
+ width: 220px;
+}
+.datepicker.datepicker-rtl {
+ direction: rtl;
+}
+.datepicker.datepicker-rtl table tr td span {
+ float: right;
+}
+.datepicker-dropdown {
+ top: 0;
+ left: 0;
+}
+.datepicker-dropdown:before {
+ content: '';
+ display: inline-block;
+ border-left: 7px solid transparent;
+ border-right: 7px solid transparent;
+ border-bottom: 7px solid #ccc;
+ border-top: 0;
+ border-bottom-color: rgba(0, 0, 0, 0.2);
+ position: absolute;
+}
+.datepicker-dropdown:after {
+ content: '';
+ display: inline-block;
+ border-left: 6px solid transparent;
+ border-right: 6px solid transparent;
+ border-bottom: 6px solid #ffffff;
+ border-top: 0;
+ position: absolute;
+}
+.datepicker-dropdown.datepicker-orient-left:before {
+ left: 6px;
+}
+.datepicker-dropdown.datepicker-orient-left:after {
+ left: 7px;
+}
+.datepicker-dropdown.datepicker-orient-right:before {
+ right: 6px;
+}
+.datepicker-dropdown.datepicker-orient-right:after {
+ right: 7px;
+}
+.datepicker-dropdown.datepicker-orient-top:before {
+ top: -7px;
+}
+.datepicker-dropdown.datepicker-orient-top:after {
+ top: -6px;
+}
+.datepicker-dropdown.datepicker-orient-bottom:before {
+ bottom: -7px;
+ border-bottom: 0;
+ border-top: 7px solid #999;
+}
+.datepicker-dropdown.datepicker-orient-bottom:after {
+ bottom: -6px;
+ border-bottom: 0;
+ border-top: 6px solid #ffffff;
+}
+.datepicker > div {
+ display: none;
+}
+.datepicker.days div.datepicker-days {
+ display: block;
+}
+.datepicker.months div.datepicker-months {
+ display: block;
+}
+.datepicker.years div.datepicker-years {
+ display: block;
+}
+.datepicker table {
+ margin: 0;
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+.datepicker td,
+.datepicker th {
+ text-align: center;
+ width: 20px;
+ height: 20px;
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
+ border: none;
+}
+.table-striped .datepicker table tr td,
+.table-striped .datepicker table tr th {
+ background-color: transparent;
+}
+.datepicker table tr td.day:hover,
+.datepicker table tr td.day.focused {
+ background: #eeeeee;
+ cursor: pointer;
+}
+.datepicker table tr td.old,
+.datepicker table tr td.new {
+ color: #999999;
+}
+.datepicker table tr td.disabled,
+.datepicker table tr td.disabled:hover {
+ background: none;
+ color: #999999;
+ cursor: default;
+}
+.datepicker table tr td.today,
+.datepicker table tr td.today:hover,
+.datepicker table tr td.today.disabled,
+.datepicker table tr td.today.disabled:hover {
+ background-color: #fde19a;
+ background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a);
+ background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a);
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a));
+ background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a);
+ background-image: -o-linear-gradient(top, #fdd49a, #fdf59a);
+ background-image: linear-gradient(top, #fdd49a, #fdf59a);
+ background-repeat: repeat-x;
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0);
+ border-color: #fdf59a #fdf59a #fbed50;
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
+ color: #000;
+}
+.datepicker table tr td.today:hover,
+.datepicker table tr td.today:hover:hover,
+.datepicker table tr td.today.disabled:hover,
+.datepicker table tr td.today.disabled:hover:hover,
+.datepicker table tr td.today:active,
+.datepicker table tr td.today:hover:active,
+.datepicker table tr td.today.disabled:active,
+.datepicker table tr td.today.disabled:hover:active,
+.datepicker table tr td.today.active,
+.datepicker table tr td.today:hover.active,
+.datepicker table tr td.today.disabled.active,
+.datepicker table tr td.today.disabled:hover.active,
+.datepicker table tr td.today.disabled,
+.datepicker table tr td.today:hover.disabled,
+.datepicker table tr td.today.disabled.disabled,
+.datepicker table tr td.today.disabled:hover.disabled,
+.datepicker table tr td.today[disabled],
+.datepicker table tr td.today:hover[disabled],
+.datepicker table tr td.today.disabled[disabled],
+.datepicker table tr td.today.disabled:hover[disabled] {
+ background-color: #fdf59a;
+}
+.datepicker table tr td.today:active,
+.datepicker table tr td.today:hover:active,
+.datepicker table tr td.today.disabled:active,
+.datepicker table tr td.today.disabled:hover:active,
+.datepicker table tr td.today.active,
+.datepicker table tr td.today:hover.active,
+.datepicker table tr td.today.disabled.active,
+.datepicker table tr td.today.disabled:hover.active {
+ background-color: #fbf069 \9;
+}
+.datepicker table tr td.today:hover:hover {
+ color: #000;
+}
+.datepicker table tr td.today.active:hover {
+ color: #fff;
+}
+.datepicker table tr td.range,
+.datepicker table tr td.range:hover,
+.datepicker table tr td.range.disabled,
+.datepicker table tr td.range.disabled:hover {
+ background: #eeeeee;
+ -webkit-border-radius: 0;
+ -moz-border-radius: 0;
+ border-radius: 0;
+}
+.datepicker table tr td.range.today,
+.datepicker table tr td.range.today:hover,
+.datepicker table tr td.range.today.disabled,
+.datepicker table tr td.range.today.disabled:hover {
+ background-color: #f3d17a;
+ background-image: -moz-linear-gradient(top, #f3c17a, #f3e97a);
+ background-image: -ms-linear-gradient(top, #f3c17a, #f3e97a);
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f3c17a), to(#f3e97a));
+ background-image: -webkit-linear-gradient(top, #f3c17a, #f3e97a);
+ background-image: -o-linear-gradient(top, #f3c17a, #f3e97a);
+ background-image: linear-gradient(top, #f3c17a, #f3e97a);
+ background-repeat: repeat-x;
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3c17a', endColorstr='#f3e97a', GradientType=0);
+ border-color: #f3e97a #f3e97a #edde34;
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
+ -webkit-border-radius: 0;
+ -moz-border-radius: 0;
+ border-radius: 0;
+}
+.datepicker table tr td.range.today:hover,
+.datepicker table tr td.range.today:hover:hover,
+.datepicker table tr td.range.today.disabled:hover,
+.datepicker table tr td.range.today.disabled:hover:hover,
+.datepicker table tr td.range.today:active,
+.datepicker table tr td.range.today:hover:active,
+.datepicker table tr td.range.today.disabled:active,
+.datepicker table tr td.range.today.disabled:hover:active,
+.datepicker table tr td.range.today.active,
+.datepicker table tr td.range.today:hover.active,
+.datepicker table tr td.range.today.disabled.active,
+.datepicker table tr td.range.today.disabled:hover.active,
+.datepicker table tr td.range.today.disabled,
+.datepicker table tr td.range.today:hover.disabled,
+.datepicker table tr td.range.today.disabled.disabled,
+.datepicker table tr td.range.today.disabled:hover.disabled,
+.datepicker table tr td.range.today[disabled],
+.datepicker table tr td.range.today:hover[disabled],
+.datepicker table tr td.range.today.disabled[disabled],
+.datepicker table tr td.range.today.disabled:hover[disabled] {
+ background-color: #f3e97a;
+}
+.datepicker table tr td.range.today:active,
+.datepicker table tr td.range.today:hover:active,
+.datepicker table tr td.range.today.disabled:active,
+.datepicker table tr td.range.today.disabled:hover:active,
+.datepicker table tr td.range.today.active,
+.datepicker table tr td.range.today:hover.active,
+.datepicker table tr td.range.today.disabled.active,
+.datepicker table tr td.range.today.disabled:hover.active {
+ background-color: #efe24b \9;
+}
+.datepicker table tr td.selected,
+.datepicker table tr td.selected:hover,
+.datepicker table tr td.selected.disabled,
+.datepicker table tr td.selected.disabled:hover {
+ background-color: #9e9e9e;
+ background-image: -moz-linear-gradient(top, #b3b3b3, #808080);
+ background-image: -ms-linear-gradient(top, #b3b3b3, #808080);
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#b3b3b3), to(#808080));
+ background-image: -webkit-linear-gradient(top, #b3b3b3, #808080);
+ background-image: -o-linear-gradient(top, #b3b3b3, #808080);
+ background-image: linear-gradient(top, #b3b3b3, #808080);
+ background-repeat: repeat-x;
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#b3b3b3', endColorstr='#808080', GradientType=0);
+ border-color: #808080 #808080 #595959;
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
+ color: #fff;
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
+}
+.datepicker table tr td.selected:hover,
+.datepicker table tr td.selected:hover:hover,
+.datepicker table tr td.selected.disabled:hover,
+.datepicker table tr td.selected.disabled:hover:hover,
+.datepicker table tr td.selected:active,
+.datepicker table tr td.selected:hover:active,
+.datepicker table tr td.selected.disabled:active,
+.datepicker table tr td.selected.disabled:hover:active,
+.datepicker table tr td.selected.active,
+.datepicker table tr td.selected:hover.active,
+.datepicker table tr td.selected.disabled.active,
+.datepicker table tr td.selected.disabled:hover.active,
+.datepicker table tr td.selected.disabled,
+.datepicker table tr td.selected:hover.disabled,
+.datepicker table tr td.selected.disabled.disabled,
+.datepicker table tr td.selected.disabled:hover.disabled,
+.datepicker table tr td.selected[disabled],
+.datepicker table tr td.selected:hover[disabled],
+.datepicker table tr td.selected.disabled[disabled],
+.datepicker table tr td.selected.disabled:hover[disabled] {
+ background-color: #808080;
+}
+.datepicker table tr td.selected:active,
+.datepicker table tr td.selected:hover:active,
+.datepicker table tr td.selected.disabled:active,
+.datepicker table tr td.selected.disabled:hover:active,
+.datepicker table tr td.selected.active,
+.datepicker table tr td.selected:hover.active,
+.datepicker table tr td.selected.disabled.active,
+.datepicker table tr td.selected.disabled:hover.active {
+ background-color: #666666 \9;
+}
+.datepicker table tr td.active,
+.datepicker table tr td.active:hover,
+.datepicker table tr td.active.disabled,
+.datepicker table tr td.active.disabled:hover {
+ background-color: #006dcc;
+ background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
+ background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
+ background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
+ background-image: -o-linear-gradient(top, #0088cc, #0044cc);
+ background-image: linear-gradient(top, #0088cc, #0044cc);
+ background-repeat: repeat-x;
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
+ border-color: #0044cc #0044cc #002a80;
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
+ color: #fff;
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
+}
+.datepicker table tr td.active:hover,
+.datepicker table tr td.active:hover:hover,
+.datepicker table tr td.active.disabled:hover,
+.datepicker table tr td.active.disabled:hover:hover,
+.datepicker table tr td.active:active,
+.datepicker table tr td.active:hover:active,
+.datepicker table tr td.active.disabled:active,
+.datepicker table tr td.active.disabled:hover:active,
+.datepicker table tr td.active.active,
+.datepicker table tr td.active:hover.active,
+.datepicker table tr td.active.disabled.active,
+.datepicker table tr td.active.disabled:hover.active,
+.datepicker table tr td.active.disabled,
+.datepicker table tr td.active:hover.disabled,
+.datepicker table tr td.active.disabled.disabled,
+.datepicker table tr td.active.disabled:hover.disabled,
+.datepicker table tr td.active[disabled],
+.datepicker table tr td.active:hover[disabled],
+.datepicker table tr td.active.disabled[disabled],
+.datepicker table tr td.active.disabled:hover[disabled] {
+ background-color: #0044cc;
+}
+.datepicker table tr td.active:active,
+.datepicker table tr td.active:hover:active,
+.datepicker table tr td.active.disabled:active,
+.datepicker table tr td.active.disabled:hover:active,
+.datepicker table tr td.active.active,
+.datepicker table tr td.active:hover.active,
+.datepicker table tr td.active.disabled.active,
+.datepicker table tr td.active.disabled:hover.active {
+ background-color: #003399 \9;
+}
+.datepicker table tr td span {
+ display: block;
+ width: 23%;
+ height: 54px;
+ line-height: 54px;
+ float: left;
+ margin: 1%;
+ cursor: pointer;
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
+}
+.datepicker table tr td span:hover {
+ background: #eeeeee;
+}
+.datepicker table tr td span.disabled,
+.datepicker table tr td span.disabled:hover {
+ background: none;
+ color: #999999;
+ cursor: default;
+}
+.datepicker table tr td span.active,
+.datepicker table tr td span.active:hover,
+.datepicker table tr td span.active.disabled,
+.datepicker table tr td span.active.disabled:hover {
+ background-color: #006dcc;
+ background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
+ background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
+ background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
+ background-image: -o-linear-gradient(top, #0088cc, #0044cc);
+ background-image: linear-gradient(top, #0088cc, #0044cc);
+ background-repeat: repeat-x;
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
+ border-color: #0044cc #0044cc #002a80;
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
+ color: #fff;
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
+}
+.datepicker table tr td span.active:hover,
+.datepicker table tr td span.active:hover:hover,
+.datepicker table tr td span.active.disabled:hover,
+.datepicker table tr td span.active.disabled:hover:hover,
+.datepicker table tr td span.active:active,
+.datepicker table tr td span.active:hover:active,
+.datepicker table tr td span.active.disabled:active,
+.datepicker table tr td span.active.disabled:hover:active,
+.datepicker table tr td span.active.active,
+.datepicker table tr td span.active:hover.active,
+.datepicker table tr td span.active.disabled.active,
+.datepicker table tr td span.active.disabled:hover.active,
+.datepicker table tr td span.active.disabled,
+.datepicker table tr td span.active:hover.disabled,
+.datepicker table tr td span.active.disabled.disabled,
+.datepicker table tr td span.active.disabled:hover.disabled,
+.datepicker table tr td span.active[disabled],
+.datepicker table tr td span.active:hover[disabled],
+.datepicker table tr td span.active.disabled[disabled],
+.datepicker table tr td span.active.disabled:hover[disabled] {
+ background-color: #0044cc;
+}
+.datepicker table tr td span.active:active,
+.datepicker table tr td span.active:hover:active,
+.datepicker table tr td span.active.disabled:active,
+.datepicker table tr td span.active.disabled:hover:active,
+.datepicker table tr td span.active.active,
+.datepicker table tr td span.active:hover.active,
+.datepicker table tr td span.active.disabled.active,
+.datepicker table tr td span.active.disabled:hover.active {
+ background-color: #003399 \9;
+}
+.datepicker table tr td span.old,
+.datepicker table tr td span.new {
+ color: #999999;
+}
+.datepicker th.datepicker-switch {
+ width: 145px;
+}
+.datepicker thead tr:first-child th,
+.datepicker tfoot tr th {
+ cursor: pointer;
+}
+.datepicker thead tr:first-child th:hover,
+.datepicker tfoot tr th:hover {
+ background: #eeeeee;
+}
+.datepicker .cw {
+ font-size: 10px;
+ width: 12px;
+ padding: 0 2px 0 5px;
+ vertical-align: middle;
+}
+.datepicker thead tr:first-child th.cw {
+ cursor: default;
+ background-color: transparent;
+}
+.input-append.date .add-on i,
+.input-prepend.date .add-on i {
+ cursor: pointer;
+ width: 16px;
+ height: 16px;
+}
+.input-daterange input {
+ text-align: center;
+}
+.input-daterange input:first-child {
+ -webkit-border-radius: 3px 0 0 3px;
+ -moz-border-radius: 3px 0 0 3px;
+ border-radius: 3px 0 0 3px;
+}
+.input-daterange input:last-child {
+ -webkit-border-radius: 0 3px 3px 0;
+ -moz-border-radius: 0 3px 3px 0;
+ border-radius: 0 3px 3px 0;
+}
+.input-daterange .add-on {
+ display: inline-block;
+ width: auto;
+ min-width: 16px;
+ height: 20px;
+ padding: 4px 5px;
+ font-weight: normal;
+ line-height: 20px;
+ text-align: center;
+ text-shadow: 0 1px 0 #ffffff;
+ vertical-align: middle;
+ background-color: #eeeeee;
+ border: 1px solid #ccc;
+ margin-left: -5px;
+ margin-right: -5px;
+}
+.datepicker.dropdown-menu {
+ position: absolute;
+ top: 100%;
+ left: 0;
+ z-index: 1000;
+ float: left;
+ display: none;
+ min-width: 160px;
+ list-style: none;
+ background-color: #ffffff;
+ border: 1px solid #ccc;
+ border: 1px solid rgba(0, 0, 0, 0.2);
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+ -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
+ -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
+ box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
+ -webkit-background-clip: padding-box;
+ -moz-background-clip: padding;
+ background-clip: padding-box;
+ *border-right-width: 2px;
+ *border-bottom-width: 2px;
+ color: #333333;
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-size: 13px;
+ line-height: 20px;
+}
+.datepicker.dropdown-menu th,
+.datepicker.dropdown-menu td {
+ padding: 4px 5px;
+}
--- /dev/null
+/* =========================================================
+ * bootstrap-datepicker.js
+ * Repo: https://github.com/eternicode/bootstrap-datepicker/
+ * Demo: http://eternicode.github.io/bootstrap-datepicker/
+ * Docs: http://bootstrap-datepicker.readthedocs.org/
+ * Forked from http://www.eyecon.ro/bootstrap-datepicker
+ * =========================================================
+ * Started by Stefan Petre; improvements by Andrew Rowls + contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================= */
+
+(function($, undefined){
+
+ var $window = $(window);
+
+ function UTCDate(){
+ return new Date(Date.UTC.apply(Date, arguments));
+ }
+ function UTCToday(){
+ var today = new Date();
+ return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());
+ }
+ function alias(method){
+ return function(){
+ return this[method].apply(this, arguments);
+ };
+ }
+
+ var DateArray = (function(){
+ var extras = {
+ get: function(i){
+ return this.slice(i)[0];
+ },
+ contains: function(d){
+ // Array.indexOf is not cross-browser;
+ // $.inArray doesn't work with Dates
+ var val = d && d.valueOf();
+ for (var i=0, l=this.length; i < l; i++)
+ if (this[i].valueOf() === val)
+ return i;
+ return -1;
+ },
+ remove: function(i){
+ this.splice(i,1);
+ },
+ replace: function(new_array){
+ if (!new_array)
+ return;
+ if (!$.isArray(new_array))
+ new_array = [new_array];
+ this.clear();
+ this.push.apply(this, new_array);
+ },
+ clear: function(){
+ this.splice(0);
+ },
+ copy: function(){
+ var a = new DateArray();
+ a.replace(this);
+ return a;
+ }
+ };
+
+ return function(){
+ var a = [];
+ a.push.apply(a, arguments);
+ $.extend(a, extras);
+ return a;
+ };
+ })();
+
+
+ // Picker object
+
+ var Datepicker = function(element, options){
+ this.dates = new DateArray();
+ this.viewDate = UTCToday();
+ this.focusDate = null;
+
+ this._process_options(options);
+
+ this.element = $(element);
+ this.isInline = false;
+ this.isInput = this.element.is('input');
+ this.component = this.element.is('.date') ? this.element.find('.add-on, .input-group-addon, .btn') : false;
+ this.hasInput = this.component && this.element.find('input').length;
+ if (this.component && this.component.length === 0)
+ this.component = false;
+
+ this.picker = $(DPGlobal.template);
+ this._buildEvents();
+ this._attachEvents();
+
+ if (this.isInline){
+ this.picker.addClass('datepicker-inline').appendTo(this.element);
+ }
+ else {
+ this.picker.addClass('datepicker-dropdown dropdown-menu');
+ }
+
+ if (this.o.rtl){
+ this.picker.addClass('datepicker-rtl');
+ }
+
+ this.viewMode = this.o.startView;
+
+ if (this.o.calendarWeeks)
+ this.picker.find('tfoot th.today')
+ .attr('colspan', function(i, val){
+ return parseInt(val) + 1;
+ });
+
+ this._allow_update = false;
+
+ this.setStartDate(this._o.startDate);
+ this.setEndDate(this._o.endDate);
+ this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);
+
+ this.fillDow();
+ this.fillMonths();
+
+ this._allow_update = true;
+
+ this.update();
+ this.showMode();
+
+ if (this.isInline){
+ this.show();
+ }
+ };
+
+ Datepicker.prototype = {
+ constructor: Datepicker,
+
+ _process_options: function(opts){
+ // Store raw options for reference
+ this._o = $.extend({}, this._o, opts);
+ // Processed options
+ var o = this.o = $.extend({}, this._o);
+
+ // Check if "de-DE" style date is available, if not language should
+ // fallback to 2 letter code eg "de"
+ var lang = o.language;
+ if (!dates[lang]){
+ lang = lang.split('-')[0];
+ if (!dates[lang])
+ lang = defaults.language;
+ }
+ o.language = lang;
+
+ switch (o.startView){
+ case 2:
+ case 'decade':
+ o.startView = 2;
+ break;
+ case 1:
+ case 'year':
+ o.startView = 1;
+ break;
+ default:
+ o.startView = 0;
+ }
+
+ switch (o.minViewMode){
+ case 1:
+ case 'months':
+ o.minViewMode = 1;
+ break;
+ case 2:
+ case 'years':
+ o.minViewMode = 2;
+ break;
+ default:
+ o.minViewMode = 0;
+ }
+
+ o.startView = Math.max(o.startView, o.minViewMode);
+
+ // true, false, or Number > 0
+ if (o.multidate !== true){
+ o.multidate = Number(o.multidate) || false;
+ if (o.multidate !== false)
+ o.multidate = Math.max(0, o.multidate);
+ else
+ o.multidate = 1;
+ }
+ o.multidateSeparator = String(o.multidateSeparator);
+
+ o.weekStart %= 7;
+ o.weekEnd = ((o.weekStart + 6) % 7);
+
+ var format = DPGlobal.parseFormat(o.format);
+ if (o.startDate !== -Infinity){
+ if (!!o.startDate){
+ if (o.startDate instanceof Date)
+ o.startDate = this._local_to_utc(this._zero_time(o.startDate));
+ else
+ o.startDate = DPGlobal.parseDate(o.startDate, format, o.language);
+ }
+ else {
+ o.startDate = -Infinity;
+ }
+ }
+ if (o.endDate !== Infinity){
+ if (!!o.endDate){
+ if (o.endDate instanceof Date)
+ o.endDate = this._local_to_utc(this._zero_time(o.endDate));
+ else
+ o.endDate = DPGlobal.parseDate(o.endDate, format, o.language);
+ }
+ else {
+ o.endDate = Infinity;
+ }
+ }
+
+ o.daysOfWeekDisabled = o.daysOfWeekDisabled||[];
+ if (!$.isArray(o.daysOfWeekDisabled))
+ o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\s]*/);
+ o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function(d){
+ return parseInt(d, 10);
+ });
+
+ var plc = String(o.orientation).toLowerCase().split(/\s+/g),
+ _plc = o.orientation.toLowerCase();
+ plc = $.grep(plc, function(word){
+ return (/^auto|left|right|top|bottom$/).test(word);
+ });
+ o.orientation = {x: 'auto', y: 'auto'};
+ if (!_plc || _plc === 'auto')
+ ; // no action
+ else if (plc.length === 1){
+ switch (plc[0]){
+ case 'top':
+ case 'bottom':
+ o.orientation.y = plc[0];
+ break;
+ case 'left':
+ case 'right':
+ o.orientation.x = plc[0];
+ break;
+ }
+ }
+ else {
+ _plc = $.grep(plc, function(word){
+ return (/^left|right$/).test(word);
+ });
+ o.orientation.x = _plc[0] || 'auto';
+
+ _plc = $.grep(plc, function(word){
+ return (/^top|bottom$/).test(word);
+ });
+ o.orientation.y = _plc[0] || 'auto';
+ }
+ },
+ _events: [],
+ _secondaryEvents: [],
+ _applyEvents: function(evs){
+ for (var i=0, el, ch, ev; i < evs.length; i++){
+ el = evs[i][0];
+ if (evs[i].length === 2){
+ ch = undefined;
+ ev = evs[i][1];
+ }
+ else if (evs[i].length === 3){
+ ch = evs[i][1];
+ ev = evs[i][2];
+ }
+ el.on(ev, ch);
+ }
+ },
+ _unapplyEvents: function(evs){
+ for (var i=0, el, ev, ch; i < evs.length; i++){
+ el = evs[i][0];
+ if (evs[i].length === 2){
+ ch = undefined;
+ ev = evs[i][1];
+ }
+ else if (evs[i].length === 3){
+ ch = evs[i][1];
+ ev = evs[i][2];
+ }
+ el.off(ev, ch);
+ }
+ },
+ _buildEvents: function(){
+ if (this.isInput){ // single input
+ this._events = [
+ [this.element, {
+ focus: $.proxy(this.show, this),
+ keyup: $.proxy(function(e){
+ if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1)
+ this.update();
+ }, this),
+ keydown: $.proxy(this.keydown, this)
+ }]
+ ];
+ }
+ else if (this.component && this.hasInput){ // component: input + button
+ this._events = [
+ // For components that are not readonly, allow keyboard nav
+ [this.element.find('input'), {
+ focus: $.proxy(this.show, this),
+ keyup: $.proxy(function(e){
+ if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1)
+ this.update();
+ }, this),
+ keydown: $.proxy(this.keydown, this)
+ }],
+ [this.component, {
+ click: $.proxy(this.show, this)
+ }]
+ ];
+ }
+ else if (this.element.is('div')){ // inline datepicker
+ this.isInline = true;
+ }
+ else {
+ this._events = [
+ [this.element, {
+ click: $.proxy(this.show, this)
+ }]
+ ];
+ }
+ this._events.push(
+ // Component: listen for blur on element descendants
+ [this.element, '*', {
+ blur: $.proxy(function(e){
+ this._focused_from = e.target;
+ }, this)
+ }],
+ // Input: listen for blur on element
+ [this.element, {
+ blur: $.proxy(function(e){
+ this._focused_from = e.target;
+ }, this)
+ }]
+ );
+
+ this._secondaryEvents = [
+ [this.picker, {
+ click: $.proxy(this.click, this)
+ }],
+ [$(window), {
+ resize: $.proxy(this.place, this)
+ }],
+ [$(document), {
+ 'mousedown touchstart': $.proxy(function(e){
+ // Clicked outside the datepicker, hide it
+ if (!(
+ this.element.is(e.target) ||
+ this.element.find(e.target).length ||
+ this.picker.is(e.target) ||
+ this.picker.find(e.target).length
+ )){
+ this.hide();
+ }
+ }, this)
+ }]
+ ];
+ },
+ _attachEvents: function(){
+ this._detachEvents();
+ this._applyEvents(this._events);
+ },
+ _detachEvents: function(){
+ this._unapplyEvents(this._events);
+ },
+ _attachSecondaryEvents: function(){
+ this._detachSecondaryEvents();
+ this._applyEvents(this._secondaryEvents);
+ },
+ _detachSecondaryEvents: function(){
+ this._unapplyEvents(this._secondaryEvents);
+ },
+ _trigger: function(event, altdate){
+ var date = altdate || this.dates.get(-1),
+ local_date = this._utc_to_local(date);
+
+ this.element.trigger({
+ type: event,
+ date: local_date,
+ dates: $.map(this.dates, this._utc_to_local),
+ format: $.proxy(function(ix, format){
+ if (arguments.length === 0){
+ ix = this.dates.length - 1;
+ format = this.o.format;
+ }
+ else if (typeof ix === 'string'){
+ format = ix;
+ ix = this.dates.length - 1;
+ }
+ format = format || this.o.format;
+ var date = this.dates.get(ix);
+ return DPGlobal.formatDate(date, format, this.o.language);
+ }, this)
+ });
+ },
+
+ show: function(){
+ if (!this.isInline)
+ this.picker.appendTo('body');
+ this.picker.show();
+ this.place();
+ this._attachSecondaryEvents();
+ this._trigger('show');
+ },
+
+ hide: function(){
+ if (this.isInline)
+ return;
+ if (!this.picker.is(':visible'))
+ return;
+ this.focusDate = null;
+ this.picker.hide().detach();
+ this._detachSecondaryEvents();
+ this.viewMode = this.o.startView;
+ this.showMode();
+
+ if (
+ this.o.forceParse &&
+ (
+ this.isInput && this.element.val() ||
+ this.hasInput && this.element.find('input').val()
+ )
+ )
+ this.setValue();
+ this._trigger('hide');
+ },
+
+ remove: function(){
+ this.hide();
+ this._detachEvents();
+ this._detachSecondaryEvents();
+ this.picker.remove();
+ delete this.element.data().datepicker;
+ if (!this.isInput){
+ delete this.element.data().date;
+ }
+ },
+
+ _utc_to_local: function(utc){
+ return utc && new Date(utc.getTime() + (utc.getTimezoneOffset()*60000));
+ },
+ _local_to_utc: function(local){
+ return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000));
+ },
+ _zero_time: function(local){
+ return local && new Date(local.getFullYear(), local.getMonth(), local.getDate());
+ },
+ _zero_utc_time: function(utc){
+ return utc && new Date(Date.UTC(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate()));
+ },
+
+ getDates: function(){
+ return $.map(this.dates, this._utc_to_local);
+ },
+
+ getUTCDates: function(){
+ return $.map(this.dates, function(d){
+ return new Date(d);
+ });
+ },
+
+ getDate: function(){
+ return this._utc_to_local(this.getUTCDate());
+ },
+
+ getUTCDate: function(){
+ return new Date(this.dates.get(-1));
+ },
+
+ setDates: function(){
+ var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
+ this.update.apply(this, args);
+ this._trigger('changeDate');
+ this.setValue();
+ },
+
+ setUTCDates: function(){
+ var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
+ this.update.apply(this, $.map(args, this._utc_to_local));
+ this._trigger('changeDate');
+ this.setValue();
+ },
+
+ setDate: alias('setDates'),
+ setUTCDate: alias('setUTCDates'),
+
+ setValue: function(){
+ var formatted = this.getFormattedDate();
+ if (!this.isInput){
+ if (this.component){
+ this.element.find('input').val(formatted).change();
+ }
+ }
+ else {
+ this.element.val(formatted).change();
+ }
+ },
+
+ getFormattedDate: function(format){
+ if (format === undefined)
+ format = this.o.format;
+
+ var lang = this.o.language;
+ return $.map(this.dates, function(d){
+ return DPGlobal.formatDate(d, format, lang);
+ }).join(this.o.multidateSeparator);
+ },
+
+ setStartDate: function(startDate){
+ this._process_options({startDate: startDate});
+ this.update();
+ this.updateNavArrows();
+ },
+
+ setEndDate: function(endDate){
+ this._process_options({endDate: endDate});
+ this.update();
+ this.updateNavArrows();
+ },
+
+ setDaysOfWeekDisabled: function(daysOfWeekDisabled){
+ this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});
+ this.update();
+ this.updateNavArrows();
+ },
+
+ place: function(){
+ if (this.isInline)
+ return;
+ var calendarWidth = this.picker.outerWidth(),
+ calendarHeight = this.picker.outerHeight(),
+ visualPadding = 10,
+ windowWidth = $window.width(),
+ windowHeight = $window.height(),
+ scrollTop = $window.scrollTop();
+
+ var zIndex = parseInt(this.element.parents().filter(function(){
+ return $(this).css('z-index') !== 'auto';
+ }).first().css('z-index'))+10;
+ var offset = this.component ? this.component.parent().offset() : this.element.offset();
+ var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);
+ var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);
+ var left = offset.left,
+ top = offset.top;
+
+ this.picker.removeClass(
+ 'datepicker-orient-top datepicker-orient-bottom '+
+ 'datepicker-orient-right datepicker-orient-left'
+ );
+
+ if (this.o.orientation.x !== 'auto'){
+ this.picker.addClass('datepicker-orient-' + this.o.orientation.x);
+ if (this.o.orientation.x === 'right')
+ left -= calendarWidth - width;
+ }
+ // auto x orientation is best-placement: if it crosses a window
+ // edge, fudge it sideways
+ else {
+ // Default to left
+ this.picker.addClass('datepicker-orient-left');
+ if (offset.left < 0)
+ left -= offset.left - visualPadding;
+ else if (offset.left + calendarWidth > windowWidth)
+ left = windowWidth - calendarWidth - visualPadding;
+ }
+
+ // auto y orientation is best-situation: top or bottom, no fudging,
+ // decision based on which shows more of the calendar
+ var yorient = this.o.orientation.y,
+ top_overflow, bottom_overflow;
+ if (yorient === 'auto'){
+ top_overflow = -scrollTop + offset.top - calendarHeight;
+ bottom_overflow = scrollTop + windowHeight - (offset.top + height + calendarHeight);
+ if (Math.max(top_overflow, bottom_overflow) === bottom_overflow)
+ yorient = 'top';
+ else
+ yorient = 'bottom';
+ }
+ this.picker.addClass('datepicker-orient-' + yorient);
+ if (yorient === 'top')
+ top += height;
+ else
+ top -= calendarHeight + parseInt(this.picker.css('padding-top'));
+
+ this.picker.css({
+ top: top,
+ left: left,
+ zIndex: zIndex
+ });
+ },
+
+ _allow_update: true,
+ update: function(){
+ if (!this._allow_update)
+ return;
+
+ var oldDates = this.dates.copy(),
+ dates = [],
+ fromArgs = false;
+ if (arguments.length){
+ $.each(arguments, $.proxy(function(i, date){
+ if (date instanceof Date)
+ date = this._local_to_utc(date);
+ dates.push(date);
+ }, this));
+ fromArgs = true;
+ }
+ else {
+ dates = this.isInput
+ ? this.element.val()
+ : this.element.data('date') || this.element.find('input').val();
+ if (dates && this.o.multidate)
+ dates = dates.split(this.o.multidateSeparator);
+ else
+ dates = [dates];
+ delete this.element.data().date;
+ }
+
+ dates = $.map(dates, $.proxy(function(date){
+ return DPGlobal.parseDate(date, this.o.format, this.o.language);
+ }, this));
+ dates = $.grep(dates, $.proxy(function(date){
+ return (
+ date < this.o.startDate ||
+ date > this.o.endDate ||
+ !date
+ );
+ }, this), true);
+ this.dates.replace(dates);
+
+ if (this.dates.length)
+ this.viewDate = new Date(this.dates.get(-1));
+ else if (this.viewDate < this.o.startDate)
+ this.viewDate = new Date(this.o.startDate);
+ else if (this.viewDate > this.o.endDate)
+ this.viewDate = new Date(this.o.endDate);
+
+ if (fromArgs){
+ // setting date by clicking
+ this.setValue();
+ }
+ else if (dates.length){
+ // setting date by typing
+ if (String(oldDates) !== String(this.dates))
+ this._trigger('changeDate');
+ }
+ if (!this.dates.length && oldDates.length)
+ this._trigger('clearDate');
+
+ this.fill();
+ },
+
+ fillDow: function(){
+ var dowCnt = this.o.weekStart,
+ html = '<tr>';
+ if (this.o.calendarWeeks){
+ var cell = '<th class="cw"> </th>';
+ html += cell;
+ this.picker.find('.datepicker-days thead tr:first-child').prepend(cell);
+ }
+ while (dowCnt < this.o.weekStart + 7){
+ html += '<th class="dow">'+dates[this.o.language].daysMin[(dowCnt++)%7]+'</th>';
+ }
+ html += '</tr>';
+ this.picker.find('.datepicker-days thead').append(html);
+ },
+
+ fillMonths: function(){
+ var html = '',
+ i = 0;
+ while (i < 12){
+ html += '<span class="month">'+dates[this.o.language].monthsShort[i++]+'</span>';
+ }
+ this.picker.find('.datepicker-months td').html(html);
+ },
+
+ setRange: function(range){
+ if (!range || !range.length)
+ delete this.range;
+ else
+ this.range = $.map(range, function(d){
+ return d.valueOf();
+ });
+ this.fill();
+ },
+
+ getClassNames: function(date){
+ var cls = [],
+ year = this.viewDate.getUTCFullYear(),
+ month = this.viewDate.getUTCMonth(),
+ today = new Date();
+ if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){
+ cls.push('old');
+ }
+ else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){
+ cls.push('new');
+ }
+ if (this.focusDate && date.valueOf() === this.focusDate.valueOf())
+ cls.push('focused');
+ // Compare internal UTC date with local today, not UTC today
+ if (this.o.todayHighlight &&
+ date.getUTCFullYear() === today.getFullYear() &&
+ date.getUTCMonth() === today.getMonth() &&
+ date.getUTCDate() === today.getDate()){
+ cls.push('today');
+ }
+ if (this.dates.contains(date) !== -1)
+ cls.push('active');
+ if (date.valueOf() < this.o.startDate || date.valueOf() > this.o.endDate ||
+ $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1){
+ cls.push('disabled');
+ }
+ if (this.range){
+ if (date > this.range[0] && date < this.range[this.range.length-1]){
+ cls.push('range');
+ }
+ if ($.inArray(date.valueOf(), this.range) !== -1){
+ cls.push('selected');
+ }
+ }
+ return cls;
+ },
+
+ fill: function(){
+ var d = new Date(this.viewDate),
+ year = d.getUTCFullYear(),
+ month = d.getUTCMonth(),
+ startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,
+ startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,
+ endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,
+ endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,
+ todaytxt = dates[this.o.language].today || dates['en'].today || '',
+ cleartxt = dates[this.o.language].clear || dates['en'].clear || '',
+ tooltip;
+ this.picker.find('.datepicker-days thead th.datepicker-switch')
+ .text(dates[this.o.language].months[month]+' '+year);
+ this.picker.find('tfoot th.today')
+ .text(todaytxt)
+ .toggle(this.o.todayBtn !== false);
+ this.picker.find('tfoot th.clear')
+ .text(cleartxt)
+ .toggle(this.o.clearBtn !== false);
+ this.updateNavArrows();
+ this.fillMonths();
+ var prevMonth = UTCDate(year, month-1, 28),
+ day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
+ prevMonth.setUTCDate(day);
+ prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7);
+ var nextMonth = new Date(prevMonth);
+ nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
+ nextMonth = nextMonth.valueOf();
+ var html = [];
+ var clsName;
+ while (prevMonth.valueOf() < nextMonth){
+ if (prevMonth.getUTCDay() === this.o.weekStart){
+ html.push('<tr>');
+ if (this.o.calendarWeeks){
+ // ISO 8601: First week contains first thursday.
+ // ISO also states week starts on Monday, but we can be more abstract here.
+ var
+ // Start of current week: based on weekstart/current date
+ ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),
+ // Thursday of this week
+ th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),
+ // First Thursday of year, year from thursday
+ yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5),
+ // Calendar week: ms between thursdays, div ms per day, div 7 days
+ calWeek = (th - yth) / 864e5 / 7 + 1;
+ html.push('<td class="cw">'+ calWeek +'</td>');
+
+ }
+ }
+ clsName = this.getClassNames(prevMonth);
+ clsName.push('day');
+
+ if (this.o.beforeShowDay !== $.noop){
+ var before = this.o.beforeShowDay(this._utc_to_local(prevMonth));
+ if (before === undefined)
+ before = {};
+ else if (typeof(before) === 'boolean')
+ before = {enabled: before};
+ else if (typeof(before) === 'string')
+ before = {classes: before};
+ if (before.enabled === false)
+ clsName.push('disabled');
+ if (before.classes)
+ clsName = clsName.concat(before.classes.split(/\s+/));
+ if (before.tooltip)
+ tooltip = before.tooltip;
+ }
+
+ clsName = $.unique(clsName);
+ html.push('<td class="'+clsName.join(' ')+'"' + (tooltip ? ' title="'+tooltip+'"' : '') + '>'+prevMonth.getUTCDate() + '</td>');
+ if (prevMonth.getUTCDay() === this.o.weekEnd){
+ html.push('</tr>');
+ }
+ prevMonth.setUTCDate(prevMonth.getUTCDate()+1);
+ }
+ this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
+
+ var months = this.picker.find('.datepicker-months')
+ .find('th:eq(1)')
+ .text(year)
+ .end()
+ .find('span').removeClass('active');
+
+ $.each(this.dates, function(i, d){
+ if (d.getUTCFullYear() === year)
+ months.eq(d.getUTCMonth()).addClass('active');
+ });
+
+ if (year < startYear || year > endYear){
+ months.addClass('disabled');
+ }
+ if (year === startYear){
+ months.slice(0, startMonth).addClass('disabled');
+ }
+ if (year === endYear){
+ months.slice(endMonth+1).addClass('disabled');
+ }
+
+ html = '';
+ year = parseInt(year/10, 10) * 10;
+ var yearCont = this.picker.find('.datepicker-years')
+ .find('th:eq(1)')
+ .text(year + '-' + (year + 9))
+ .end()
+ .find('td');
+ year -= 1;
+ var years = $.map(this.dates, function(d){
+ return d.getUTCFullYear();
+ }),
+ classes;
+ for (var i = -1; i < 11; i++){
+ classes = ['year'];
+ if (i === -1)
+ classes.push('old');
+ else if (i === 10)
+ classes.push('new');
+ if ($.inArray(year, years) !== -1)
+ classes.push('active');
+ if (year < startYear || year > endYear)
+ classes.push('disabled');
+ html += '<span class="' + classes.join(' ') + '">'+year+'</span>';
+ year += 1;
+ }
+ yearCont.html(html);
+ },
+
+ updateNavArrows: function(){
+ if (!this._allow_update)
+ return;
+
+ var d = new Date(this.viewDate),
+ year = d.getUTCFullYear(),
+ month = d.getUTCMonth();
+ switch (this.viewMode){
+ case 0:
+ if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()){
+ this.picker.find('.prev').css({visibility: 'hidden'});
+ }
+ else {
+ this.picker.find('.prev').css({visibility: 'visible'});
+ }
+ if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()){
+ this.picker.find('.next').css({visibility: 'hidden'});
+ }
+ else {
+ this.picker.find('.next').css({visibility: 'visible'});
+ }
+ break;
+ case 1:
+ case 2:
+ if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear()){
+ this.picker.find('.prev').css({visibility: 'hidden'});
+ }
+ else {
+ this.picker.find('.prev').css({visibility: 'visible'});
+ }
+ if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear()){
+ this.picker.find('.next').css({visibility: 'hidden'});
+ }
+ else {
+ this.picker.find('.next').css({visibility: 'visible'});
+ }
+ break;
+ }
+ },
+
+ click: function(e){
+ e.preventDefault();
+ var target = $(e.target).closest('span, td, th'),
+ year, month, day;
+ if (target.length === 1){
+ switch (target[0].nodeName.toLowerCase()){
+ case 'th':
+ switch (target[0].className){
+ case 'datepicker-switch':
+ this.showMode(1);
+ break;
+ case 'prev':
+ case 'next':
+ var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1);
+ switch (this.viewMode){
+ case 0:
+ this.viewDate = this.moveMonth(this.viewDate, dir);
+ this._trigger('changeMonth', this.viewDate);
+ break;
+ case 1:
+ case 2:
+ this.viewDate = this.moveYear(this.viewDate, dir);
+ if (this.viewMode === 1)
+ this._trigger('changeYear', this.viewDate);
+ break;
+ }
+ this.fill();
+ break;
+ case 'today':
+ var date = new Date();
+ date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
+
+ this.showMode(-2);
+ var which = this.o.todayBtn === 'linked' ? null : 'view';
+ this._setDate(date, which);
+ break;
+ case 'clear':
+ var element;
+ if (this.isInput)
+ element = this.element;
+ else if (this.component)
+ element = this.element.find('input');
+ if (element)
+ element.val("").change();
+ this.update();
+ this._trigger('changeDate');
+ if (this.o.autoclose)
+ this.hide();
+ break;
+ }
+ break;
+ case 'span':
+ if (!target.is('.disabled')){
+ this.viewDate.setUTCDate(1);
+ if (target.is('.month')){
+ day = 1;
+ month = target.parent().find('span').index(target);
+ year = this.viewDate.getUTCFullYear();
+ this.viewDate.setUTCMonth(month);
+ this._trigger('changeMonth', this.viewDate);
+ if (this.o.minViewMode === 1){
+ this._setDate(UTCDate(year, month, day));
+ }
+ }
+ else {
+ day = 1;
+ month = 0;
+ year = parseInt(target.text(), 10)||0;
+ this.viewDate.setUTCFullYear(year);
+ this._trigger('changeYear', this.viewDate);
+ if (this.o.minViewMode === 2){
+ this._setDate(UTCDate(year, month, day));
+ }
+ }
+ this.showMode(-1);
+ this.fill();
+ }
+ break;
+ case 'td':
+ if (target.is('.day') && !target.is('.disabled')){
+ day = parseInt(target.text(), 10)||1;
+ year = this.viewDate.getUTCFullYear();
+ month = this.viewDate.getUTCMonth();
+ if (target.is('.old')){
+ if (month === 0){
+ month = 11;
+ year -= 1;
+ }
+ else {
+ month -= 1;
+ }
+ }
+ else if (target.is('.new')){
+ if (month === 11){
+ month = 0;
+ year += 1;
+ }
+ else {
+ month += 1;
+ }
+ }
+ this._setDate(UTCDate(year, month, day));
+ }
+ break;
+ }
+ }
+ if (this.picker.is(':visible') && this._focused_from){
+ $(this._focused_from).focus();
+ }
+ delete this._focused_from;
+ },
+
+ _toggle_multidate: function(date){
+ var ix = this.dates.contains(date);
+ if (!date){
+ this.dates.clear();
+ }
+ else if (ix !== -1){
+ this.dates.remove(ix);
+ }
+ else {
+ this.dates.push(date);
+ }
+ if (typeof this.o.multidate === 'number')
+ while (this.dates.length > this.o.multidate)
+ this.dates.remove(0);
+ },
+
+ _setDate: function(date, which){
+ if (!which || which === 'date')
+ this._toggle_multidate(date && new Date(date));
+ if (!which || which === 'view')
+ this.viewDate = date && new Date(date);
+
+ this.fill();
+ this.setValue();
+ this._trigger('changeDate');
+ var element;
+ if (this.isInput){
+ element = this.element;
+ }
+ else if (this.component){
+ element = this.element.find('input');
+ }
+ if (element){
+ element.change();
+ }
+ if (this.o.autoclose && (!which || which === 'date')){
+ this.hide();
+ }
+ },
+
+ moveMonth: function(date, dir){
+ if (!date)
+ return undefined;
+ if (!dir)
+ return date;
+ var new_date = new Date(date.valueOf()),
+ day = new_date.getUTCDate(),
+ month = new_date.getUTCMonth(),
+ mag = Math.abs(dir),
+ new_month, test;
+ dir = dir > 0 ? 1 : -1;
+ if (mag === 1){
+ test = dir === -1
+ // If going back one month, make sure month is not current month
+ // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
+ ? function(){
+ return new_date.getUTCMonth() === month;
+ }
+ // If going forward one month, make sure month is as expected
+ // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
+ : function(){
+ return new_date.getUTCMonth() !== new_month;
+ };
+ new_month = month + dir;
+ new_date.setUTCMonth(new_month);
+ // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
+ if (new_month < 0 || new_month > 11)
+ new_month = (new_month + 12) % 12;
+ }
+ else {
+ // For magnitudes >1, move one month at a time...
+ for (var i=0; i < mag; i++)
+ // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
+ new_date = this.moveMonth(new_date, dir);
+ // ...then reset the day, keeping it in the new month
+ new_month = new_date.getUTCMonth();
+ new_date.setUTCDate(day);
+ test = function(){
+ return new_month !== new_date.getUTCMonth();
+ };
+ }
+ // Common date-resetting loop -- if date is beyond end of month, make it
+ // end of month
+ while (test()){
+ new_date.setUTCDate(--day);
+ new_date.setUTCMonth(new_month);
+ }
+ return new_date;
+ },
+
+ moveYear: function(date, dir){
+ return this.moveMonth(date, dir*12);
+ },
+
+ dateWithinRange: function(date){
+ return date >= this.o.startDate && date <= this.o.endDate;
+ },
+
+ keydown: function(e){
+ if (this.picker.is(':not(:visible)')){
+ if (e.keyCode === 27) // allow escape to hide and re-show picker
+ this.show();
+ return;
+ }
+ var dateChanged = false,
+ dir, newDate, newViewDate,
+ focusDate = this.focusDate || this.viewDate;
+ switch (e.keyCode){
+ case 27: // escape
+ if (this.focusDate){
+ this.focusDate = null;
+ this.viewDate = this.dates.get(-1) || this.viewDate;
+ this.fill();
+ }
+ else
+ this.hide();
+ e.preventDefault();
+ break;
+ case 37: // left
+ case 39: // right
+ if (!this.o.keyboardNavigation)
+ break;
+ dir = e.keyCode === 37 ? -1 : 1;
+ if (e.ctrlKey){
+ newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
+ newViewDate = this.moveYear(focusDate, dir);
+ this._trigger('changeYear', this.viewDate);
+ }
+ else if (e.shiftKey){
+ newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
+ newViewDate = this.moveMonth(focusDate, dir);
+ this._trigger('changeMonth', this.viewDate);
+ }
+ else {
+ newDate = new Date(this.dates.get(-1) || UTCToday());
+ newDate.setUTCDate(newDate.getUTCDate() + dir);
+ newViewDate = new Date(focusDate);
+ newViewDate.setUTCDate(focusDate.getUTCDate() + dir);
+ }
+ if (this.dateWithinRange(newDate)){
+ this.focusDate = this.viewDate = newViewDate;
+ this.setValue();
+ this.fill();
+ e.preventDefault();
+ }
+ break;
+ case 38: // up
+ case 40: // down
+ if (!this.o.keyboardNavigation)
+ break;
+ dir = e.keyCode === 38 ? -1 : 1;
+ if (e.ctrlKey){
+ newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
+ newViewDate = this.moveYear(focusDate, dir);
+ this._trigger('changeYear', this.viewDate);
+ }
+ else if (e.shiftKey){
+ newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
+ newViewDate = this.moveMonth(focusDate, dir);
+ this._trigger('changeMonth', this.viewDate);
+ }
+ else {
+ newDate = new Date(this.dates.get(-1) || UTCToday());
+ newDate.setUTCDate(newDate.getUTCDate() + dir * 7);
+ newViewDate = new Date(focusDate);
+ newViewDate.setUTCDate(focusDate.getUTCDate() + dir * 7);
+ }
+ if (this.dateWithinRange(newDate)){
+ this.focusDate = this.viewDate = newViewDate;
+ this.setValue();
+ this.fill();
+ e.preventDefault();
+ }
+ break;
+ case 32: // spacebar
+ // Spacebar is used in manually typing dates in some formats.
+ // As such, its behavior should not be hijacked.
+ break;
+ case 13: // enter
+ focusDate = this.focusDate || this.dates.get(-1) || this.viewDate;
+ this._toggle_multidate(focusDate);
+ dateChanged = true;
+ this.focusDate = null;
+ this.viewDate = this.dates.get(-1) || this.viewDate;
+ this.setValue();
+ this.fill();
+ if (this.picker.is(':visible')){
+ e.preventDefault();
+ if (this.o.autoclose)
+ this.hide();
+ }
+ break;
+ case 9: // tab
+ this.focusDate = null;
+ this.viewDate = this.dates.get(-1) || this.viewDate;
+ this.fill();
+ this.hide();
+ break;
+ }
+ if (dateChanged){
+ if (this.dates.length)
+ this._trigger('changeDate');
+ else
+ this._trigger('clearDate');
+ var element;
+ if (this.isInput){
+ element = this.element;
+ }
+ else if (this.component){
+ element = this.element.find('input');
+ }
+ if (element){
+ element.change();
+ }
+ }
+ },
+
+ showMode: function(dir){
+ if (dir){
+ this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir));
+ }
+ this.picker
+ .find('>div')
+ .hide()
+ .filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName)
+ .css('display', 'block');
+ this.updateNavArrows();
+ }
+ };
+
+ var DateRangePicker = function(element, options){
+ this.element = $(element);
+ this.inputs = $.map(options.inputs, function(i){
+ return i.jquery ? i[0] : i;
+ });
+ delete options.inputs;
+
+ $(this.inputs)
+ .datepicker(options)
+ .bind('changeDate', $.proxy(this.dateUpdated, this));
+
+ this.pickers = $.map(this.inputs, function(i){
+ return $(i).data('datepicker');
+ });
+ this.updateDates();
+ };
+ DateRangePicker.prototype = {
+ updateDates: function(){
+ this.dates = $.map(this.pickers, function(i){
+ return i.getUTCDate();
+ });
+ this.updateRanges();
+ },
+ updateRanges: function(){
+ var range = $.map(this.dates, function(d){
+ return d.valueOf();
+ });
+ $.each(this.pickers, function(i, p){
+ p.setRange(range);
+ });
+ },
+ dateUpdated: function(e){
+ // `this.updating` is a workaround for preventing infinite recursion
+ // between `changeDate` triggering and `setUTCDate` calling. Until
+ // there is a better mechanism.
+ if (this.updating)
+ return;
+ this.updating = true;
+
+ var dp = $(e.target).data('datepicker'),
+ new_date = dp.getUTCDate(),
+ i = $.inArray(e.target, this.inputs),
+ l = this.inputs.length;
+ if (i === -1)
+ return;
+
+ $.each(this.pickers, function(i, p){
+ if (!p.getUTCDate())
+ p.setUTCDate(new_date);
+ });
+
+ if (new_date < this.dates[i]){
+ // Date being moved earlier/left
+ while (i >= 0 && new_date < this.dates[i]){
+ this.pickers[i--].setUTCDate(new_date);
+ }
+ }
+ else if (new_date > this.dates[i]){
+ // Date being moved later/right
+ while (i < l && new_date > this.dates[i]){
+ this.pickers[i++].setUTCDate(new_date);
+ }
+ }
+ this.updateDates();
+
+ delete this.updating;
+ },
+ remove: function(){
+ $.map(this.pickers, function(p){ p.remove(); });
+ delete this.element.data().datepicker;
+ }
+ };
+
+ function opts_from_el(el, prefix){
+ // Derive options from element data-attrs
+ var data = $(el).data(),
+ out = {}, inkey,
+ replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])');
+ prefix = new RegExp('^' + prefix.toLowerCase());
+ function re_lower(_,a){
+ return a.toLowerCase();
+ }
+ for (var key in data)
+ if (prefix.test(key)){
+ inkey = key.replace(replace, re_lower);
+ out[inkey] = data[key];
+ }
+ return out;
+ }
+
+ function opts_from_locale(lang){
+ // Derive options from locale plugins
+ var out = {};
+ // Check if "de-DE" style date is available, if not language should
+ // fallback to 2 letter code eg "de"
+ if (!dates[lang]){
+ lang = lang.split('-')[0];
+ if (!dates[lang])
+ return;
+ }
+ var d = dates[lang];
+ $.each(locale_opts, function(i,k){
+ if (k in d)
+ out[k] = d[k];
+ });
+ return out;
+ }
+
+ var old = $.fn.datepicker;
+ $.fn.datepicker = function(option){
+ var args = Array.apply(null, arguments);
+ args.shift();
+ var internal_return;
+ this.each(function(){
+ var $this = $(this),
+ data = $this.data('datepicker'),
+ options = typeof option === 'object' && option;
+ if (!data){
+ var elopts = opts_from_el(this, 'date'),
+ // Preliminary otions
+ xopts = $.extend({}, defaults, elopts, options),
+ locopts = opts_from_locale(xopts.language),
+ // Options priority: js args, data-attrs, locales, defaults
+ opts = $.extend({}, defaults, locopts, elopts, options);
+ if ($this.is('.input-daterange') || opts.inputs){
+ var ropts = {
+ inputs: opts.inputs || $this.find('input').toArray()
+ };
+ $this.data('datepicker', (data = new DateRangePicker(this, $.extend(opts, ropts))));
+ }
+ else {
+ $this.data('datepicker', (data = new Datepicker(this, opts)));
+ }
+ }
+ if (typeof option === 'string' && typeof data[option] === 'function'){
+ internal_return = data[option].apply(data, args);
+ if (internal_return !== undefined)
+ return false;
+ }
+ });
+ if (internal_return !== undefined)
+ return internal_return;
+ else
+ return this;
+ };
+
+ var defaults = $.fn.datepicker.defaults = {
+ autoclose: false,
+ beforeShowDay: $.noop,
+ calendarWeeks: false,
+ clearBtn: false,
+ daysOfWeekDisabled: [],
+ endDate: Infinity,
+ forceParse: true,
+ format: 'mm/dd/yyyy',
+ keyboardNavigation: true,
+ language: 'en',
+ minViewMode: 0,
+ multidate: false,
+ multidateSeparator: ',',
+ orientation: "auto",
+ rtl: false,
+ startDate: -Infinity,
+ startView: 0,
+ todayBtn: false,
+ todayHighlight: false,
+ weekStart: 0
+ };
+ var locale_opts = $.fn.datepicker.locale_opts = [
+ 'format',
+ 'rtl',
+ 'weekStart'
+ ];
+ $.fn.datepicker.Constructor = Datepicker;
+ var dates = $.fn.datepicker.dates = {
+ en: {
+ days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
+ daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
+ daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
+ months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
+ monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
+ today: "Today",
+ clear: "Clear"
+ }
+ };
+
+ var DPGlobal = {
+ modes: [
+ {
+ clsName: 'days',
+ navFnc: 'Month',
+ navStep: 1
+ },
+ {
+ clsName: 'months',
+ navFnc: 'FullYear',
+ navStep: 1
+ },
+ {
+ clsName: 'years',
+ navFnc: 'FullYear',
+ navStep: 10
+ }],
+ isLeapYear: function(year){
+ return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
+ },
+ getDaysInMonth: function(year, month){
+ return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
+ },
+ validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,
+ nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,
+ parseFormat: function(format){
+ // IE treats \0 as a string end in inputs (truncating the value),
+ // so it's a bad format delimiter, anyway
+ var separators = format.replace(this.validParts, '\0').split('\0'),
+ parts = format.match(this.validParts);
+ if (!separators || !separators.length || !parts || parts.length === 0){
+ throw new Error("Invalid date format.");
+ }
+ return {separators: separators, parts: parts};
+ },
+ parseDate: function(date, format, language){
+ if (!date)
+ return undefined;
+ if (date instanceof Date)
+ return date;
+ if (typeof format === 'string')
+ format = DPGlobal.parseFormat(format);
+ var part_re = /([\-+]\d+)([dmwy])/,
+ parts = date.match(/([\-+]\d+)([dmwy])/g),
+ part, dir, i;
+ if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)){
+ date = new Date();
+ for (i=0; i < parts.length; i++){
+ part = part_re.exec(parts[i]);
+ dir = parseInt(part[1]);
+ switch (part[2]){
+ case 'd':
+ date.setUTCDate(date.getUTCDate() + dir);
+ break;
+ case 'm':
+ date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir);
+ break;
+ case 'w':
+ date.setUTCDate(date.getUTCDate() + dir * 7);
+ break;
+ case 'y':
+ date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir);
+ break;
+ }
+ }
+ return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0);
+ }
+ parts = date && date.match(this.nonpunctuation) || [];
+ date = new Date();
+ var parsed = {},
+ setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],
+ setters_map = {
+ yyyy: function(d,v){
+ return d.setUTCFullYear(v);
+ },
+ yy: function(d,v){
+ return d.setUTCFullYear(2000+v);
+ },
+ m: function(d,v){
+ if (isNaN(d))
+ return d;
+ v -= 1;
+ while (v < 0) v += 12;
+ v %= 12;
+ d.setUTCMonth(v);
+ while (d.getUTCMonth() !== v)
+ d.setUTCDate(d.getUTCDate()-1);
+ return d;
+ },
+ d: function(d,v){
+ return d.setUTCDate(v);
+ }
+ },
+ val, filtered;
+ setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];
+ setters_map['dd'] = setters_map['d'];
+ date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
+ var fparts = format.parts.slice();
+ // Remove noop parts
+ if (parts.length !== fparts.length){
+ fparts = $(fparts).filter(function(i,p){
+ return $.inArray(p, setters_order) !== -1;
+ }).toArray();
+ }
+ // Process remainder
+ function match_part(){
+ var m = this.slice(0, parts[i].length),
+ p = parts[i].slice(0, m.length);
+ return m === p;
+ }
+ if (parts.length === fparts.length){
+ var cnt;
+ for (i=0, cnt = fparts.length; i < cnt; i++){
+ val = parseInt(parts[i], 10);
+ part = fparts[i];
+ if (isNaN(val)){
+ switch (part){
+ case 'MM':
+ filtered = $(dates[language].months).filter(match_part);
+ val = $.inArray(filtered[0], dates[language].months) + 1;
+ break;
+ case 'M':
+ filtered = $(dates[language].monthsShort).filter(match_part);
+ val = $.inArray(filtered[0], dates[language].monthsShort) + 1;
+ break;
+ }
+ }
+ parsed[part] = val;
+ }
+ var _date, s;
+ for (i=0; i < setters_order.length; i++){
+ s = setters_order[i];
+ if (s in parsed && !isNaN(parsed[s])){
+ _date = new Date(date);
+ setters_map[s](_date, parsed[s]);
+ if (!isNaN(_date))
+ date = _date;
+ }
+ }
+ }
+ return date;
+ },
+ formatDate: function(date, format, language){
+ if (!date)
+ return '';
+ if (typeof format === 'string')
+ format = DPGlobal.parseFormat(format);
+ var val = {
+ d: date.getUTCDate(),
+ D: dates[language].daysShort[date.getUTCDay()],
+ DD: dates[language].days[date.getUTCDay()],
+ m: date.getUTCMonth() + 1,
+ M: dates[language].monthsShort[date.getUTCMonth()],
+ MM: dates[language].months[date.getUTCMonth()],
+ yy: date.getUTCFullYear().toString().substring(2),
+ yyyy: date.getUTCFullYear()
+ };
+ val.dd = (val.d < 10 ? '0' : '') + val.d;
+ val.mm = (val.m < 10 ? '0' : '') + val.m;
+ date = [];
+ var seps = $.extend([], format.separators);
+ for (var i=0, cnt = format.parts.length; i <= cnt; i++){
+ if (seps.length)
+ date.push(seps.shift());
+ date.push(val[format.parts[i]]);
+ }
+ return date.join('');
+ },
+ headTemplate: '<thead>'+
+ '<tr>'+
+ '<th class="prev">«</th>'+
+ '<th colspan="5" class="datepicker-switch"></th>'+
+ '<th class="next">»</th>'+
+ '</tr>'+
+ '</thead>',
+ contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
+ footTemplate: '<tfoot>'+
+ '<tr>'+
+ '<th colspan="7" class="today"></th>'+
+ '</tr>'+
+ '<tr>'+
+ '<th colspan="7" class="clear"></th>'+
+ '</tr>'+
+ '</tfoot>'
+ };
+ DPGlobal.template = '<div class="datepicker">'+
+ '<div class="datepicker-days">'+
+ '<table class=" table-condensed">'+
+ DPGlobal.headTemplate+
+ '<tbody></tbody>'+
+ DPGlobal.footTemplate+
+ '</table>'+
+ '</div>'+
+ '<div class="datepicker-months">'+
+ '<table class="table-condensed">'+
+ DPGlobal.headTemplate+
+ DPGlobal.contTemplate+
+ DPGlobal.footTemplate+
+ '</table>'+
+ '</div>'+
+ '<div class="datepicker-years">'+
+ '<table class="table-condensed">'+
+ DPGlobal.headTemplate+
+ DPGlobal.contTemplate+
+ DPGlobal.footTemplate+
+ '</table>'+
+ '</div>'+
+ '</div>';
+
+ $.fn.datepicker.DPGlobal = DPGlobal;
+
+
+ /* DATEPICKER NO CONFLICT
+ * =================== */
+
+ $.fn.datepicker.noConflict = function(){
+ $.fn.datepicker = old;
+ return this;
+ };
+
+
+ /* DATEPICKER DATA-API
+ * ================== */
+
+ $(document).on(
+ 'focus.datepicker.data-api click.datepicker.data-api',
+ '[data-provide="datepicker"]',
+ function(e){
+ var $this = $(this);
+ if ($this.data('datepicker'))
+ return;
+ e.preventDefault();
+ // component click requires us to explicitly show it
+ $this.datepicker('show');
+ }
+ );
+ $(function(){
+ $('[data-provide="datepicker-inline"]').datepicker();
+ });
+
+}(window.jQuery));
--- /dev/null
+body {
+ background: #f0f0f0;
+ color: #444;
+ font-family: helvetica, arial, sans-serif;
+ font-size: 15px;
+ line-height: 1.3;
+ margin: 0;
+ padding: 0;
+}
+
+header,
+section,
+footer {
+ padding: 20px;
+}
+
+header,
+footer {
+ background: #d4d4d4;
+ color: #666;
+ position: relative;
+}
+
+header h1 {
+ margin: 0;
+ padding: 0;
+}
+
+header h1 a {
+ font-family: Lucida Sans Unicode, Lucida Grande, sans-serif;
+ font-size: 60px;
+ font-weight: 200;
+ text-decoration: none;
+}
+
+header p {
+ font-size: 23px;
+}
+
+#header-links {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+ position: absolute;
+ right: 20px;
+ top: 30px;
+ text-align: right;
+}
+
+#header-links a {
+ color: #888;
+}
+
+#header-links a:hover {
+ color: #06c;
+}
+
+h2 {
+ color: #444;
+ font-size: 35px;
+ font-weight: normal;
+ margin: 0;
+ line-height: 1.1
+}
+
+p {
+ margin: 20px 0 0 0;
+}
+
+p:first-child {
+ margin-top: 0;
+}
+
+input {
+ font-size: 13px;
+ -webkit-border-radius: 3px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+ padding: 3px;
+ background: #fff;
+ border: 1px solid #aac;
+}
+
+input.time {
+ width: 80px;
+}
+
+input.date {
+ width: 90px;
+}
+
+a {
+ color: #06c;
+ text-decoration: none;
+}
+
+a:hover {
+ text-decoration: underline;
+}
+
+image {
+ border: 0;
+}
+
+.body-text {
+ width: 700px;
+}
+
+#examples article {
+ padding-top: 100px;
+ clear: both;
+}
+
+#examples article:first-child {
+ padding-top: 0;
+}
+
+#examples .demo {
+ width: 450px;
+ float: left;
+}
+
+#examples .code {
+ font-size: 12px;
+ margin: 0 0 0 470px;
+}
+
+footer {
+ font-size: 12px;
+}
+
+/**
+ * Blackboard theme
+ *
+ * Adapted from Domenico Carbotta's TextMate theme of the same name
+ *
+ * @author Domenico Carbotta
+ * @author Craig Campbell
+ * @version 1.0.2
+ */
+pre {
+ background: #0B1022;
+ word-wrap: break-word;
+ margin: 0px;
+ padding: 0px;
+ padding: 10px;
+ color: #fff;
+ font-size: 14px;
+ margin-bottom: 20px;
+}
+
+pre, code {
+ font-family: 'Monaco', courier, monospace;
+}
+
+pre .comment {
+ color: #727272;
+}
+
+pre .constant {
+ color: #D8FA3C;
+}
+
+pre .storage {
+ color: #FBDE2D;
+}
+
+pre .string, pre .comment.docstring {
+ color: #61CE3C;
+}
+
+pre .string.regexp, pre .support.tag.script, pre .support.tag.style {
+ color: #fff;
+}
+
+pre .keyword, pre .selector {
+ color: #FBDE2D;
+}
+
+pre .inherited-class {
+ font-style: italic;
+}
+
+pre .entity {
+ color: #FF6400;
+}
+
+pre .support, *[data-language="c"] .function.call {
+ color: #8DA6CE;
+}
+
+pre .variable.global, pre .variable.class, pre .variable.instance {
+ color: #FF6400;
+}
+
--- /dev/null
+/* Rainbow v1.1.9 rainbowco.de | included languages: generic, javascript */
+window.Rainbow=function(){function q(a){var b,c=a.getAttribute&&a.getAttribute("data-language")||0;if(!c){a=a.attributes;for(b=0;b<a.length;++b)if("data-language"===a[b].nodeName)return a[b].nodeValue}return c}function B(a){var b=q(a)||q(a.parentNode);if(!b){var c=/\blang(?:uage)?-(\w+)/;(a=a.className.match(c)||a.parentNode.className.match(c))&&(b=a[1])}return b}function C(a,b){for(var c in e[d]){c=parseInt(c,10);if(a==c&&b==e[d][c]?0:a<=c&&b>=e[d][c])delete e[d][c],delete j[d][c];if(a>=c&&a<e[d][c]||
+b>c&&b<e[d][c])return!0}return!1}function r(a,b){return'<span class="'+a.replace(/\./g," ")+(l?" "+l:"")+'">'+b+"</span>"}function s(a,b,c,h){var f=a.exec(c);if(f){++t;!b.name&&"string"==typeof b.matches[0]&&(b.name=b.matches[0],delete b.matches[0]);var k=f[0],i=f.index,u=f[0].length+i,g=function(){function f(){s(a,b,c,h)}t%100>0?f():setTimeout(f,0)};if(C(i,u))g();else{var m=v(b.matches),l=function(a,c,h){if(a>=c.length)h(k);else{var d=f[c[a]];if(d){var e=b.matches[c[a]],i=e.language,g=e.name&&e.matches?
+e.matches:e,j=function(b,d,e){var i;i=0;var g;for(g=1;g<c[a];++g)f[g]&&(i=i+f[g].length);d=e?r(e,d):d;k=k.substr(0,i)+k.substr(i).replace(b,d);l(++a,c,h)};i?n(d,i,function(a){j(d,a)}):typeof e==="string"?j(d,d,e):w(d,g.length?g:[g],function(a){j(d,a,e.matches?e.name:0)})}else l(++a,c,h)}};l(0,m,function(a){b.name&&(a=r(b.name,a));if(!j[d]){j[d]={};e[d]={}}j[d][i]={replace:f[0],"with":a};e[d][i]=u;g()})}}else h()}function v(a){var b=[],c;for(c in a)a.hasOwnProperty(c)&&b.push(c);return b.sort(function(a,
+b){return b-a})}function w(a,b,c){function h(b,k){k<b.length?s(b[k].pattern,b[k],a,function(){h(b,++k)}):D(a,function(a){delete j[d];delete e[d];--d;c(a)})}++d;h(b,0)}function D(a,b){function c(a,b,h,e){if(h<b.length){++x;var g=b[h],l=j[d][g],a=a.substr(0,g)+a.substr(g).replace(l.replace,l["with"]),g=function(){c(a,b,++h,e)};0<x%250?g():setTimeout(g,0)}else e(a)}var h=v(j[d]);c(a,h,0,b)}function n(a,b,c){var d=m[b]||[],f=m[y]||[],b=z[b]?d:d.concat(f);w(a.replace(/</g,"<").replace(/>/g,">").replace(/&(?![\w\#]+;)/g,
+"&"),b,c)}function o(a,b,c){if(b<a.length){var d=a[b],f=B(d);return!(-1<(" "+d.className+" ").indexOf(" rainbow "))&&f?(f=f.toLowerCase(),d.className+=d.className?" rainbow":"rainbow",n(d.innerHTML,f,function(k){d.innerHTML=k;j={};e={};p&&p(d,f);setTimeout(function(){o(a,++b,c)},0)})):o(a,++b,c)}c&&c()}function A(a,b){var a=a&&"function"==typeof a.getElementsByTagName?a:document,c=a.getElementsByTagName("pre"),d=a.getElementsByTagName("code"),f,e=[];for(f=0;f<d.length;++f)e.push(d[f]);for(f=0;f<
+c.length;++f)c[f].getElementsByTagName("code").length||e.push(c[f]);o(e,0,b)}var j={},e={},m={},z={},d=0,y=0,t=0,x=0,l,p;return{extend:function(a,b,c){1==arguments.length&&(b=a,a=y);z[a]=c;m[a]=b.concat(m[a]||[])},b:function(a){p=a},a:function(a){l=a},color:function(a,b,c){if("string"==typeof a)return n(a,b,c);if("function"==typeof a)return A(0,a);A(a,b)}}}();window.addEventListener?window.addEventListener("load",Rainbow.color,!1):window.attachEvent("onload",Rainbow.color);Rainbow.onHighlight=Rainbow.b;
+Rainbow.addClass=Rainbow.a;Rainbow.extend([{matches:{1:{name:"keyword.operator",pattern:/\=/g},2:{name:"string",matches:{name:"constant.character.escape",pattern:/\\('|"){1}/g}}},pattern:/(\(|\s|\[|\=|:)(('|")([^\\\1]|\\.)*?(\3))/gm},{name:"comment",pattern:/\/\*[\s\S]*?\*\/|(\/\/|\#)[\s\S]*?$/gm},{name:"constant.numeric",pattern:/\b(\d+(\.\d+)?(e(\+|\-)?\d+)?(f|d)?|0x[\da-f]+)\b/gi},{matches:{1:"keyword"},pattern:/\b(and|array|as|bool(ean)?|c(atch|har|lass|onst)|d(ef|elete|o(uble)?)|e(cho|lse(if)?|xit|xtends|xcept)|f(inally|loat|or(each)?|unction)|global|if|import|int(eger)?|long|new|object|or|pr(int|ivate|otected)|public|return|self|st(ring|ruct|atic)|switch|th(en|is|row)|try|(un)?signed|var|void|while)(?=\(|\b)/gi},
+{name:"constant.language",pattern:/true|false|null/g},{name:"keyword.operator",pattern:/\+|\!|\-|&(gt|lt|amp);|\||\*|\=/g},{matches:{1:"function.call"},pattern:/(\w+?)(?=\()/g},{matches:{1:"storage.function",2:"entity.name.function"},pattern:/(function)\s(.*?)(?=\()/g}]);Rainbow.extend("javascript",[{name:"selector",pattern:/(\s|^)\$(?=\.|\()/g},{name:"support",pattern:/\b(window|document)\b/g},{matches:{1:"support.property"},pattern:/\.(length|node(Name|Value))\b/g},{matches:{1:"support.function"},pattern:/(setTimeout|setInterval)(?=\()/g},{matches:{1:"support.method"},pattern:/\.(getAttribute|push|getElementById|getElementsByClassName|log|setTimeout|setInterval)(?=\()/g},{matches:{1:"support.tag.script",2:[{name:"string",pattern:/('|")(.*?)(\1)/g},{name:"entity.tag.script",
+pattern:/(\w+)/g}],3:"support.tag.script"},pattern:/(<\/?)(script.*?)(>)/g},{name:"string.regexp",matches:{1:"string.regexp.open",2:{name:"constant.regexp.escape",pattern:/\\(.){1}/g},3:"string.regexp.close",4:"string.regexp.modifier"},pattern:/(\/)(?!\*)(.+)(\/)([igm]{0,3})/g},{matches:{1:"storage",3:"entity.function"},pattern:/(var)?(\s|^)(.*)(?=\s?=\s?function\()/g},{name:"entity.function",pattern:/(\w+)(?=:\s{0,}function)/g}]);
--- /dev/null
+{
+ "name": "timepicker",
+ "version": "1.11.1",
+ "title": "jquery-timepicker",
+ "author": {
+ "name": "Jon Thornton",
+ "url": "https://github.com/jonthornton"
+ },
+ "license": "MIT",
+ "dependencies": {
+ "jquery": ">=1.7"
+ },
+ "devDependencies": {
+ "grunt": "~0.4.1",
+ "grunt-cli": "~0.1.9",
+ "grunt-contrib-uglify": "~0.11.0",
+ "grunt-contrib-jshint": "^0.11.3",
+ "grunt-contrib-cssmin": "~0.4.1"
+ },
+ "main": "jquery.timepicker.min.js",
+ "description": "A jQuery timepicker plugin inspired by Google Calendar. It supports both mouse and keyboard navigation.",
+ "keywords": [ "timepicker", "time", "picker", "ui", "google calendar" ],
+ "homepage": "http://jonthornton.github.com/jquery-timepicker/",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/jonthornton/jquery-timepicker.git"
+ },
+ "bugs": {
+ "url": "https://github.com/jonthornton/jquery-timepicker/issues"
+ }
+}