diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..26b3838
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+/node_modules/
+*.iml
+.idea
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..97b25f1
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,14 @@
+{
+ "curly": true,
+ "eqeqeq": true,
+ "immed": true,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "sub": true,
+ "undef": true,
+ "unused": true,
+ "boss": true,
+ "eqnull": true,
+ "node": true
+}
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..260644f
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,31 @@
+# Contributing
+
+## Important notes
+Please don't edit files in the `dist` subdirectory as they are generated via Grunt. You'll find source code in the `src` subdirectory!
+
+### Code style
+Regarding code style like indentation and whitespace, **follow the conventions you see used in the source already (tabs).**
+
+### PhantomJS
+While Grunt can run the included unit tests via [PhantomJS](http://phantomjs.org/), this shouldn't be considered a substitute for the real thing. Please be sure to test the `test/*.html` unit test file(s) in _actual_ browsers.
+
+## Modifying the code
+First, ensure that you have the latest [Node.js](http://nodejs.org/) and [npm](http://npmjs.org/) installed.
+
+Test that Grunt's CLI is installed by running `grunt --version`. If the command isn't found, run `npm install -g grunt-cli`. For more information about installing Grunt, see the [getting started guide](http://gruntjs.com/getting-started).
+
+1. Fork and clone the repo.
+1. Run `npm install` to install all dependencies (including Grunt).
+1. Run `grunt` to grunt this project.
+
+Assuming that you don't see any red, you're ready to go. Just be sure to run `grunt` after making any changes, to ensure that nothing is broken.
+
+## Submitting pull requests
+
+1. Create a new branch, please don't work in your `master` branch directly. Please pull from the `dev` branch.
+1. Add failing tests for the change you want to make. Run `grunt` to see the tests fail.
+1. Fix stuff.
+1. Run `grunt` to see if the tests pass. Repeat steps 2-4 until done.
+1. Open `test/*.html` unit test file(s) in actual browser to ensure tests pass everywhere.
+1. Update the documentation to reflect any changes.
+1. Push to your fork and submit a pull request (back to the `dev` branch).
diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644
index 0000000..48f326f
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,170 @@
+'use strict';
+
+module.exports = function(grunt) {
+
+ // Project configuration.
+ grunt.initConfig({
+ // Metadata.
+ pkg: grunt.file.readJSON('jquery-ui-timepicker-addon.json'),
+ banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
+ //'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
+ '<%= pkg.modified %>\n' +
+ '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
+ '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
+ ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
+ // Task configuration.
+ clean: {
+ files: ['dist']
+ },
+ copy: {
+ dist: {
+ files: [
+ //{ src: 'src/index.html', dest: 'dist/index.html' },
+ { src: 'src/<%= pkg.name %>.css', dest: 'dist/<%= pkg.name %>.css' },
+ { src: 'src/jquery-ui-sliderAccess.js', dest: 'dist/jquery-ui-sliderAccess.js' },
+ { src: 'src/i18n/jquery-ui-timepicker-*.js', dest: 'dist/i18n/', expand:true, flatten: true }
+ ]
+ }
+ },
+ concat: {
+ dist: {
+ options: {
+ banner: '<%= banner %>',
+ stripBanners: true
+ },
+ src: ['src/<%= pkg.name %>.js'],
+ dest: 'dist/<%= pkg.name %>.js'
+ },
+ docs: {
+ src: [
+ 'src/docs/header.html',
+ 'src/docs/intro.html',
+ 'src/docs/options.html',
+ 'src/docs/formatting.html',
+ 'src/docs/i18n.html',
+ 'src/docs/examples.html',
+ 'src/docs/footer.html'
+ ],
+ dest: 'dist/index.html'
+ },
+ i18n: {
+ options: {
+ //stripBanners: true,
+ banner: '<%=banner %>\n(function($){\n\n',
+ footer: '\n})(jQuery);\n',
+ process: function(src, filepath){
+ return '// source: '+ filepath + '\n' +
+ src.replace(/\(function\s*\(\$\)\s*\{/g, '')
+ .replace(/\}\)\(jQuery\)\;/g, '')
+ .replace(/\$\.timepicker\.setDefaults\(\$\.timepicker\.regional\[[a-z\-\'\"]+\]\)\;/gi, '')
+ .trim() +'\n';
+ }
+ },
+ src: [ 'src/i18n/jquery-ui-timepicker-*.js' ],
+ dest: 'dist/i18n/<%=pkg.name %>-i18n.js'
+ }
+ },
+ uglify: {
+ options: {
+ banner: '<%= banner %>'
+ },
+ dist: {
+ src: '<%= concat.dist.dest %>',
+ dest: 'dist/<%= pkg.name %>.min.js'
+ },
+ i18n: {
+ src: 'dist/i18n/<%=pkg.name %>-i18n.js',
+ dest: 'dist/i18n/<%=pkg.name %>-i18n.min.js'
+ }
+ },
+ cssmin: {
+ options: {
+ banner: '<%= banner %>'
+ },
+ dist: {
+ src: 'dist/<%= pkg.name %>.css',
+ dest: 'dist/<%= pkg.name %>.min.css'
+ }
+ },
+ replace: {
+ dist: {
+ options: {
+ variables: {
+ version: '<%= pkg.version %>',
+ timestamp: '<%= pkg.modified %>'
+ },
+ prefix: '@@'
+ },
+ files: [
+ { src: 'dist/<%= pkg.name %>.js', dest: 'dist/<%= pkg.name %>.js' },
+ { src: 'dist/<%= pkg.name %>.css', dest: 'dist/<%= pkg.name %>.css' },
+ { src: 'dist/index.html', dest: 'dist/index.html' }
+ ]
+ }
+ },
+ jasmine: {
+ src: 'src/<%= pkg.name %>.js',
+ options: {
+ specs: 'test/*_spec.js',
+ vendor: [
+ 'http://code.jquery.com/jquery-1.11.1.min.js',
+ 'http://code.jquery.com/ui/1.11.1/jquery-ui.min.js',
+ 'http://github.com/searls/jasmine-fixture/releases/1.0.5/1737/jasmine-fixture.js'
+ ]
+ }
+ },
+ jshint: {
+ gruntfile: {
+ options: {
+ jshintrc: '.jshintrc'
+ },
+ src: 'Gruntfile.js'
+ },
+ src: {
+ options: {
+ jshintrc: 'src/.jshintrc'
+ },
+ src: ['src/**/*.js']
+ },
+ test: {
+ options: {
+ jshintrc: 'test/.jshintrc'
+ },
+ src: ['test/**/*.js']
+ }
+ },
+ watch: {
+ gruntfile: {
+ files: '<%= jshint.gruntfile.src %>',
+ tasks: ['jshint:gruntfile']
+ },
+ src: {
+ files: 'src/**',//'<%= jshint.src.src %>',
+ tasks: ['jshint:src', 'jasmine', 'clean', 'copy', 'concat', 'replace', 'uglify', 'cssmin']
+ //tasks: ['jshint:src', 'jasmine']
+ },
+ test: {
+ files: '<%= jshint.test.src %>',
+ tasks: ['jshint:test', 'jasmine']
+ }
+ }
+ });
+
+ // These plugins provide necessary tasks.
+ grunt.loadNpmTasks('grunt-contrib-clean');
+ grunt.loadNpmTasks('grunt-contrib-concat');
+ grunt.loadNpmTasks('grunt-contrib-copy');
+ grunt.loadNpmTasks('grunt-replace');
+ grunt.loadNpmTasks('grunt-contrib-uglify');
+ grunt.loadNpmTasks('grunt-contrib-cssmin');
+ grunt.loadNpmTasks('grunt-contrib-jasmine');
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+ grunt.loadNpmTasks('grunt-contrib-watch');
+
+ // Default task.
+ grunt.registerTask('default', ['clean', 'copy', 'concat', 'replace', 'uglify', 'cssmin']);
+
+ // Test task.
+ grunt.registerTask('test', ['jshint', 'jasmine']);
+
+};
diff --git a/LICENSE-MIT b/LICENSE-MIT
new file mode 100644
index 0000000..957a11c
--- /dev/null
+++ b/LICENSE-MIT
@@ -0,0 +1,22 @@
+Copyright (c) 2013 Trent Richardson
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
index 62907c4..31e84ae 100644
--- a/README.md
+++ b/README.md
@@ -3,18 +3,50 @@ jQuery Timepicker Addon
About
-----
+
+**This project is no longer actively maintained.** Unfortuantely, I no longer work with jQuery and jQueryUI on new projects. jQuery Timepicker Addon served as the timepicker of choice for many years when there weren't many available. I'm thankful of the opportunity to contribute to the community, and thankful to everyone who contributed along the way. These days there are many great alternatives depending on the environment you're developing in. If you need a timepicker with no dependencies check out [flatpickr](https://flatpickr.js.org/).
+
+Best wishes,
+Trent Richardson
+
- Author: [Trent Richardson](http://trentrichardson.com)
- Documentation: [http://trentrichardson.com/examples/timepicker/](http://trentrichardson.com/examples/timepicker/)
- Twitter: [@practicalweb](http://twitter.com/practicalweb)
Use
---
-- To use this plugin you must include jQuery and jQuery UI with datepicker and slider
-- Include timepicker-addon script
-- now use timepicker with $('#selector').datetimepicker() or $('#selector').timepicker()
+I recommend getting the eBook [Handling Time](https://sellfy.com/p/8gxZ) as it has a lot of example code to get started. The quick and dirty:
+
+- To use this plugin you must include jQuery (1.6+) and jQuery UI with datepicker (and optionally slider).
+- Include timepicker-addon script and css located in the `dist` directory or from a CDN:
+ * [http://cdnjs.com/libraries/jquery-ui-timepicker-addon](http://cdnjs.com/libraries/jquery-ui-timepicker-addon)
+ * [http://www.jsdelivr.com/#!jquery.ui.timepicker.addon](http://www.jsdelivr.com/#!jquery.ui.timepicker.addon)
+- now use timepicker with `$('#selector').datetimepicker()` or `$('#selector').timepicker()`.
+
+There is also a [Bower](http://bower.io/) package named `jqueryui-timepicker-addon`. Beware there are other similar package names that point to forks which may not be current.
+
+Rails with Bower
+-----------------
+If you happen to use Rails with the [bower](gem "bower-rails", "~> 0.8.3") gem, here it is to use it easily :
+#### Bowerfile
+```asset "jqueryui-timepicker-addon", "1.5.6"```
+
+#### application.js
+```javascript
+//= require jqueryui-timepicker-addon/dist/jquery-ui-timepicker-addon
+//= require jqueryui-timepicker-addon/dist/i18n/jquery-ui-timepicker-fr
+```
+
+#### application.css.scss
+```scss
+@import "jqueryui-timepicker-addon/dist/jquery-ui-timepicker-addon.css";
+```
Contributing Code - Please Read!
--------------------------------
- All code contributions and bug reports are much appreciated.
- Please be sure to apply your fixes to the "dev" branch.
-- Also note tabs are appreciated over spaces.
\ No newline at end of file
+- Also note tabs are appreciated over spaces.
+- Please read the [CONTRIBUTING.md][contributingmd] for more on using Grunt to produce builds.
+
+[contributingmd]: CONTRIBUTING.md
diff --git a/bower.json b/bower.json
new file mode 100644
index 0000000..3c1e1ea
--- /dev/null
+++ b/bower.json
@@ -0,0 +1,21 @@
+{
+ "name": "jqueryui-timepicker-addon",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/trentrichardson/jQuery-Timepicker-Addon.git"
+ },
+ "main": ["dist/jquery-ui-timepicker-addon.js", "dist/jquery-ui-timepicker-addon.css"],
+ "ignore": [
+ "/CONTRIBUTING.md",
+ "/Gruntfile.js",
+ "/README.md",
+ "/composer.json",
+ "/jquery-ui-timepicker-addon.json",
+ "/lib",
+ "/package.json",
+ "/src",
+ "/test"
+ ],
+ "dependencies": {
+ }
+}
\ No newline at end of file
diff --git a/component.json b/component.json
deleted file mode 100644
index 7e1fc6a..0000000
--- a/component.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "name": "jquery-timepicker-addon",
- "version": "1.2",
- "repository": {
- "type": "git",
- "url": "git://github.com/trentrichardson/jQuery-Timepicker-Addon.git"
- },
- "dependencies": {
- "jquery-ui": "~1.9.2"
- }
-}
\ No newline at end of file
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..150661e
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,26 @@
+{
+ "name": "trentrichardson/jquery-timepicker-addon",
+ "description": "Adds a timepicker to jQueryUI Datepicker.",
+ "type": "component",
+ "homepage": "http://trentrichardson.com/examples/timepicker/",
+ "license": [
+ "MIT"
+ ],
+ "require": {
+ "robloach/component-installer": "*",
+ "components/jqueryui": "~1.10.2"
+ },
+ "extra": {
+ "component": {
+ "name": "jquery-timepicker-addon",
+ "scripts": [
+ "dist/jquery-ui-sliderAccess.js",
+ "dist/jquery-ui-timepicker-addon.js",
+ "dist/i18n/**"
+ ],
+ "styles": [
+ "dist/jquery-ui-timepicker-addon.css"
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/dist/i18n/jquery-ui-timepicker-addon-i18n.js b/dist/i18n/jquery-ui-timepicker-addon-i18n.js
new file mode 100644
index 0000000..3ced863
--- /dev/null
+++ b/dist/i18n/jquery-ui-timepicker-addon-i18n.js
@@ -0,0 +1,974 @@
+/*! jQuery Timepicker Addon - v1.6.3 - 2016-04-20
+* http://trentrichardson.com/examples/timepicker
+* Copyright (c) 2016 Trent Richardson; Licensed MIT */
+
+(function($){
+
+// source: src/i18n/jquery-ui-timepicker-af.js
+/* Afrikaans translation for the jQuery Timepicker Addon */
+/* Written by Deon Heyns */
+
+ $.timepicker.regional['af'] = {
+ timeOnlyTitle: 'Kies Tyd',
+ timeText: 'Tyd ',
+ hourText: 'Ure ',
+ minuteText: 'Minute',
+ secondText: 'Sekondes',
+ millisecText: 'Millisekondes',
+ microsecText: 'Mikrosekondes',
+ timezoneText: 'Tydsone',
+ currentText: 'Huidige Tyd',
+ closeText: 'Klaar',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-am.js
+/* Armenian translation for the jQuery Timepicker Addon */
+/* Written by Artavazd Avetisyan artavazda@hotmail.com */
+
+ $.timepicker.regional['am'] = {
+ timeOnlyTitle: 'Ընտրեք ժամանակը',
+ timeText: 'Ժամանակը',
+ hourText: 'Ժամ',
+ minuteText: 'Րոպե',
+ secondText: 'Վարկյան',
+ millisecText: 'Միլիվարկյան',
+ microsecText: 'Միկրովարկյան',
+ timezoneText: 'Ժամային գոտին',
+ currentText: 'Այժմ',
+ closeText: 'Փակել',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-bg.js
+/* Bulgarian translation for the jQuery Timepicker Addon */
+/* Written by Plamen Kovandjiev */
+
+ $.timepicker.regional['bg'] = {
+ timeOnlyTitle: 'Изберете време',
+ timeText: 'Време',
+ hourText: 'Час',
+ minuteText: 'Минути',
+ secondText: 'Секунди',
+ millisecText: 'Милисекунди',
+ microsecText: 'Микросекунди',
+ timezoneText: 'Часови пояс',
+ currentText: 'Сега',
+ closeText: 'Затвори',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-ca.js
+/* Catalan translation for the jQuery Timepicker Addon */
+/* Written by Sergi Faber */
+
+ $.timepicker.regional['ca'] = {
+ timeOnlyTitle: 'Escollir una hora',
+ timeText: 'Hora',
+ hourText: 'Hores',
+ minuteText: 'Minuts',
+ secondText: 'Segons',
+ millisecText: 'Milisegons',
+ microsecText: 'Microsegons',
+ timezoneText: 'Fus horari',
+ currentText: 'Ara',
+ closeText: 'Tancar',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-cs.js
+/* Czech translation for the jQuery Timepicker Addon */
+/* Written by Ondřej Vodáček */
+
+ $.timepicker.regional['cs'] = {
+ timeOnlyTitle: 'Vyberte čas',
+ timeText: 'Čas',
+ hourText: 'Hodiny',
+ minuteText: 'Minuty',
+ secondText: 'Vteřiny',
+ millisecText: 'Milisekundy',
+ microsecText: 'Mikrosekundy',
+ timezoneText: 'Časové pásmo',
+ currentText: 'Nyní',
+ closeText: 'Zavřít',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['dop.', 'AM', 'A'],
+ pmNames: ['odp.', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-da.js
+/* Danish translation for the jQuery Timepicker Addon */
+/* Written by Lars H. Jensen (http://www.larshj.dk) */
+
+ $.timepicker.regional['da'] = {
+ timeOnlyTitle: 'Vælg tid',
+ timeText: 'Tid',
+ hourText: 'Time',
+ minuteText: 'Minut',
+ secondText: 'Sekund',
+ millisecText: 'Millisekund',
+ microsecText: 'Mikrosekund',
+ timezoneText: 'Tidszone',
+ currentText: 'Nu',
+ closeText: 'Luk',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['am', 'AM', 'A'],
+ pmNames: ['pm', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-de.js
+/* German translation for the jQuery Timepicker Addon */
+/* Written by Marvin */
+
+ $.timepicker.regional['de'] = {
+ timeOnlyTitle: 'Zeit wählen',
+ timeText: 'Zeit',
+ hourText: 'Stunde',
+ minuteText: 'Minute',
+ secondText: 'Sekunde',
+ millisecText: 'Millisekunde',
+ microsecText: 'Mikrosekunde',
+ timezoneText: 'Zeitzone',
+ currentText: 'Jetzt',
+ closeText: 'Fertig',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['vorm.', 'AM', 'A'],
+ pmNames: ['nachm.', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-el.js
+/* Hellenic translation for the jQuery Timepicker Addon */
+/* Written by Christos Pontikis */
+
+ $.timepicker.regional['el'] = {
+ timeOnlyTitle: 'Επιλογή ώρας',
+ timeText: 'Ώρα',
+ hourText: 'Ώρες',
+ minuteText: 'Λεπτά',
+ secondText: 'Δευτερόλεπτα',
+ millisecText: 'Χιλιοστοδευτερόλεπτα',
+ microsecText: 'Μικροδευτερόλεπτα',
+ timezoneText: 'Ζώνη ώρας',
+ currentText: 'Τώρα',
+ closeText: 'Κλείσιμο',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['π.μ.', 'AM', 'A'],
+ pmNames: ['μ.μ.', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-es.js
+/* Spanish translation for the jQuery Timepicker Addon */
+/* Written by Ianaré Sévi */
+/* Modified by Carlos Martínez */
+
+ $.timepicker.regional['es'] = {
+ timeOnlyTitle: 'Elegir una hora',
+ timeText: 'Hora',
+ hourText: 'Horas',
+ minuteText: 'Minutos',
+ secondText: 'Segundos',
+ millisecText: 'Milisegundos',
+ microsecText: 'Microsegundos',
+ timezoneText: 'Uso horario',
+ currentText: 'Hoy',
+ closeText: 'Cerrar',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['a.m.', 'AM', 'A'],
+ pmNames: ['p.m.', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-et.js
+/* Estonian translation for the jQuery Timepicker Addon */
+/* Written by Karl Sutt (karl@sutt.ee) */
+
+ $.timepicker.regional['et'] = {
+ timeOnlyTitle: 'Vali aeg',
+ timeText: 'Aeg',
+ hourText: 'Tund',
+ minuteText: 'Minut',
+ secondText: 'Sekund',
+ millisecText: 'Millisekundis',
+ microsecText: 'Mikrosekundis',
+ timezoneText: 'Ajavöönd',
+ currentText: 'Praegu',
+ closeText: 'Valmis',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-eu.js
+/* Basque trannslation for JQuery Timepicker Addon */
+/* Translated by Xabi Fer */
+/* Fixed by Asier Iturralde Sarasola - iametza interaktiboa */
+
+ $.timepicker.regional['eu'] = {
+ timeOnlyTitle: 'Aukeratu ordua',
+ timeText: 'Ordua',
+ hourText: 'Orduak',
+ minuteText: 'Minutuak',
+ secondText: 'Segundoak',
+ millisecText: 'Milisegundoak',
+ microsecText: 'Mikrosegundoak',
+ timezoneText: 'Ordu-eremua',
+ currentText: 'Orain',
+ closeText: 'Itxi',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['a.m.', 'AM', 'A'],
+ pmNames: ['p.m.', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-fa.js
+/* Persian translation for the jQuery Timepicker Addon */
+/* Written by Meysam Pour Ganji */
+
+ $.timepicker.regional['fa'] = {
+ timeOnlyTitle: 'انتخاب زمان',
+ timeText: 'زمان',
+ hourText: 'ساعت',
+ minuteText: 'دقیقه',
+ secondText: 'ثانیه',
+ millisecText: 'میلی ثانیه',
+ microsecText: 'میکرو ثانیه',
+ timezoneText: 'منطقه زمانی',
+ currentText: 'الان',
+ closeText: 'انتخاب',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['قبل ظهر', 'AM', 'A'],
+ pmNames: ['بعد ظهر', 'PM', 'P'],
+ isRTL: true
+ };
+
+// source: src/i18n/jquery-ui-timepicker-fi.js
+/* Finnish translation for the jQuery Timepicker Addon */
+/* Written by Juga Paazmaya (http://github.com/paazmaya) */
+
+ $.timepicker.regional['fi'] = {
+ timeOnlyTitle: 'Valitse aika',
+ timeText: 'Aika',
+ hourText: 'Tunti',
+ minuteText: 'Minuutti',
+ secondText: 'Sekunti',
+ millisecText: 'Millisekunnin',
+ microsecText: 'Mikrosekuntia',
+ timezoneText: 'Aikavyöhyke',
+ currentText: 'Nyt',
+ closeText: 'Sulje',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['ap.', 'AM', 'A'],
+ pmNames: ['ip.', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-fr.js
+/* French translation for the jQuery Timepicker Addon */
+/* Written by Thomas Lété */
+
+ $.timepicker.regional['fr'] = {
+ timeOnlyTitle: 'Choisir une heure',
+ timeText: 'Heure',
+ hourText: 'Heures',
+ minuteText: 'Minutes',
+ secondText: 'Secondes',
+ millisecText: 'Millisecondes',
+ microsecText: 'Microsecondes',
+ timezoneText: 'Fuseau horaire',
+ currentText: 'Maintenant',
+ closeText: 'Terminé',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-gl.js
+/* Galician translation for the jQuery Timepicker Addon */
+/* Written by David Barral */
+
+ $.timepicker.regional['gl'] = {
+ timeOnlyTitle: 'Elixir unha hora',
+ timeText: 'Hora',
+ hourText: 'Horas',
+ minuteText: 'Minutos',
+ secondText: 'Segundos',
+ millisecText: 'Milisegundos',
+ microsecText: 'Microssegundos',
+ timezoneText: 'Fuso horario',
+ currentText: 'Agora',
+ closeText: 'Pechar',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['a.m.', 'AM', 'A'],
+ pmNames: ['p.m.', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-he.js
+/* Hebrew translation for the jQuery Timepicker Addon */
+/* Written by Lior Lapid */
+
+ $.timepicker.regional["he"] = {
+ timeOnlyTitle: "בחירת זמן",
+ timeText: "שעה",
+ hourText: "שעות",
+ minuteText: "דקות",
+ secondText: "שניות",
+ millisecText: "אלפית השנייה",
+ microsecText: "מיקרו",
+ timezoneText: "אזור זמן",
+ currentText: "עכשיו",
+ closeText:"סגור",
+ timeFormat: "HH:mm",
+ timeSuffix: '',
+ amNames: ['לפנה"צ', 'AM', 'A'],
+ pmNames: ['אחה"צ', 'PM', 'P'],
+ isRTL: true
+ };
+
+// source: src/i18n/jquery-ui-timepicker-hr.js
+/* Croatian translation for the jQuery Timepicker Addon */
+/* Written by Mladen */
+
+ $.timepicker.regional['hr'] = {
+ timeOnlyTitle: 'Odaberi vrijeme',
+ timeText: 'Vrijeme',
+ hourText: 'Sati',
+ minuteText: 'Minute',
+ secondText: 'Sekunde',
+ millisecText: 'Milisekunde',
+ microsecText: 'Mikrosekunde',
+ timezoneText: 'Vremenska zona',
+ currentText: 'Sada',
+ closeText: 'Gotovo',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['a.m.', 'AM', 'A'],
+ pmNames: ['p.m.', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-hu.js
+/* Hungarian translation for the jQuery Timepicker Addon */
+/* Written by Vas Gábor */
+
+ $.timepicker.regional['hu'] = {
+ timeOnlyTitle: 'Válasszon időpontot',
+ timeText: 'Idő',
+ hourText: 'Óra',
+ minuteText: 'Perc',
+ secondText: 'Másodperc',
+ millisecText: 'Milliszekundumos',
+ microsecText: 'Ezredmásodperc',
+ timezoneText: 'Időzóna',
+ currentText: 'Most',
+ closeText: 'Kész',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['de.', 'AM', 'A'],
+ pmNames: ['du.', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-id.js
+/* Indonesian translation for the jQuery Timepicker Addon */
+/* Written by Nia */
+
+ $.timepicker.regional['id'] = {
+ timeOnlyTitle: 'Pilih Waktu',
+ timeText: 'Waktu',
+ hourText: 'Pukul',
+ minuteText: 'Menit',
+ secondText: 'Detik',
+ millisecText: 'Milidetik',
+ microsecText: 'Mikrodetik',
+ timezoneText: 'Zona Waktu',
+ currentText: 'Sekarang',
+ closeText: 'OK',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-it.js
+/* Italian translation for the jQuery Timepicker Addon */
+/* Written by Marco "logicoder" Del Tongo */
+
+ $.timepicker.regional['it'] = {
+ timeOnlyTitle: 'Scegli orario',
+ timeText: 'Orario',
+ hourText: 'Ora',
+ minuteText: 'Minuti',
+ secondText: 'Secondi',
+ millisecText: 'Millisecondi',
+ microsecText: 'Microsecondi',
+ timezoneText: 'Fuso orario',
+ currentText: 'Adesso',
+ closeText: 'Chiudi',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['m.', 'AM', 'A'],
+ pmNames: ['p.', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-ja.js
+/* Japanese translation for the jQuery Timepicker Addon */
+/* Written by Jun Omae */
+
+ $.timepicker.regional['ja'] = {
+ timeOnlyTitle: '時間を選択',
+ timeText: '時間',
+ hourText: '時',
+ minuteText: '分',
+ secondText: '秒',
+ millisecText: 'ミリ秒',
+ microsecText: 'マイクロ秒',
+ timezoneText: 'タイムゾーン',
+ currentText: '現時刻',
+ closeText: '閉じる',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['午前', 'AM', 'A'],
+ pmNames: ['午後', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-ko.js
+/* Korean translation for the jQuery Timepicker Addon */
+/* Written by Genie */
+
+ $.timepicker.regional['ko'] = {
+ timeOnlyTitle: '시간 선택',
+ timeText: '시간',
+ hourText: '시',
+ minuteText: '분',
+ secondText: '초',
+ millisecText: '밀리초',
+ microsecText: '마이크로',
+ timezoneText: '표준 시간대',
+ currentText: '현재 시각',
+ closeText: '닫기',
+ timeFormat: 'tt h:mm',
+ timeSuffix: '',
+ amNames: ['오전', 'AM', 'A'],
+ pmNames: ['오후', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-lt.js
+/* Lithuanian translation for the jQuery Timepicker Addon */
+/* Written by Irmantas Šiupšinskas */
+
+ $.timepicker.regional['lt'] = {
+ timeOnlyTitle: 'Pasirinkite laiką',
+ timeText: 'Laikas',
+ hourText: 'Valandos',
+ minuteText: 'Minutės',
+ secondText: 'Sekundės',
+ millisecText: 'Milisekundės',
+ microsecText: 'Mikrosekundės',
+ timezoneText: 'Laiko zona',
+ currentText: 'Dabar',
+ closeText: 'Uždaryti',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['priešpiet', 'AM', 'A'],
+ pmNames: ['popiet', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-lv.js
+/* Latvian translation for the jQuery Timepicker Addon */
+/* Written by Dmitry Bogatykh */
+
+ $.timepicker.regional['lv'] = {
+ timeOnlyTitle: 'Ievadiet laiku',
+ timeText: 'Laiks',
+ hourText: 'Stundas',
+ minuteText: 'Minūtes',
+ secondText: 'Sekundes',
+ millisecText: 'Milisekundes',
+ microsecText: 'Mikrosekundes',
+ timezoneText: 'Laika josla',
+ currentText: 'Tagad',
+ closeText: 'Aizvērt',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'AM', 'A'],
+ pmNames: ['PM', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-mk.js
+/* Macedonian cyrilic translation for the jQuery Timepicker Addon */
+/* Written by Vlatko Ristovski */
+
+ $.timepicker.regional['mk'] = {
+ timeOnlyTitle: 'Одберете време',
+ timeText: 'Време',
+ hourText: 'Час',
+ minuteText: 'Минути',
+ secondText: 'Секунди',
+ millisecText: 'Милисекунди',
+ microsecText: 'Микросекунди',
+ timezoneText: 'Временска зона',
+ currentText: 'Сега',
+ closeText: 'Затвори',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-nl.js
+/* Dutch translation for the jQuery Timepicker Addon */
+/* Written by Martijn van der Lee */
+
+ $.timepicker.regional['nl'] = {
+ timeOnlyTitle: 'Tijdstip',
+ timeText: 'Tijd',
+ hourText: 'Uur',
+ minuteText: 'Minuut',
+ secondText: 'Seconde',
+ millisecText: 'Milliseconde',
+ microsecText: 'Microseconde',
+ timezoneText: 'Tijdzone',
+ currentText: 'Vandaag',
+ closeText: 'Sluiten',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-no.js
+/* Norwegian translation for the jQuery Timepicker Addon */
+/* Written by Morten Hauan (http://hauan.me) */
+
+ $.timepicker.regional['no'] = {
+ timeOnlyTitle: 'Velg tid',
+ timeText: 'Tid',
+ hourText: 'Time',
+ minuteText: 'Minutt',
+ secondText: 'Sekund',
+ millisecText: 'Millisekund',
+ microsecText: 'mikrosekund',
+ timezoneText: 'Tidssone',
+ currentText: 'Nå',
+ closeText: 'Lukk',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['am', 'AM', 'A'],
+ pmNames: ['pm', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-pl.js
+/* Polish translation for the jQuery Timepicker Addon */
+/* Written by Michał Pena */
+
+ $.timepicker.regional['pl'] = {
+ timeOnlyTitle: 'Wybierz godzinę',
+ timeText: 'Czas',
+ hourText: 'Godzina',
+ minuteText: 'Minuta',
+ secondText: 'Sekunda',
+ millisecText: 'Milisekunda',
+ microsecText: 'Mikrosekunda',
+ timezoneText: 'Strefa czasowa',
+ currentText: 'Teraz',
+ closeText: 'Gotowe',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-pt-BR.js
+/* Brazilian Portuguese translation for the jQuery Timepicker Addon */
+/* Written by Diogo Damiani (diogodamiani@gmail.com) */
+
+ $.timepicker.regional['pt-BR'] = {
+ timeOnlyTitle: 'Escolha o horário',
+ timeText: 'Horário',
+ hourText: 'Hora',
+ minuteText: 'Minutos',
+ secondText: 'Segundos',
+ millisecText: 'Milissegundos',
+ microsecText: 'Microssegundos',
+ timezoneText: 'Fuso horário',
+ currentText: 'Agora',
+ closeText: 'Fechar',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['a.m.', 'AM', 'A'],
+ pmNames: ['p.m.', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-pt.js
+/* Portuguese translation for the jQuery Timepicker Addon */
+/* Written by Luan Almeida */
+
+ $.timepicker.regional['pt'] = {
+ timeOnlyTitle: 'Escolha uma hora',
+ timeText: 'Hora',
+ hourText: 'Horas',
+ minuteText: 'Minutos',
+ secondText: 'Segundos',
+ millisecText: 'Milissegundos',
+ microsecText: 'Microssegundos',
+ timezoneText: 'Fuso horário',
+ currentText: 'Agora',
+ closeText: 'Fechar',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['a.m.', 'AM', 'A'],
+ pmNames: ['p.m.', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-ro.js
+/* Romanian translation for the jQuery Timepicker Addon */
+/* Written by Romeo Adrian Cioaba */
+
+ $.timepicker.regional['ro'] = {
+ timeOnlyTitle: 'Alegeţi o oră',
+ timeText: 'Timp',
+ hourText: 'Ore',
+ minuteText: 'Minute',
+ secondText: 'Secunde',
+ millisecText: 'Milisecunde',
+ microsecText: 'Microsecunde',
+ timezoneText: 'Fus orar',
+ currentText: 'Acum',
+ closeText: 'Închide',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-ru.js
+/* Russian translation for the jQuery Timepicker Addon */
+/* Written by Trent Richardson */
+
+ $.timepicker.regional['ru'] = {
+ timeOnlyTitle: 'Выберите время',
+ timeText: 'Время',
+ hourText: 'Часы',
+ minuteText: 'Минуты',
+ secondText: 'Секунды',
+ millisecText: 'Миллисекунды',
+ microsecText: 'Микросекунды',
+ timezoneText: 'Часовой пояс',
+ currentText: 'Сейчас',
+ closeText: 'Закрыть',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-sk.js
+/* Slovak translation for the jQuery Timepicker Addon */
+/* Written by David Vallner */
+
+ $.timepicker.regional['sk'] = {
+ timeOnlyTitle: 'Zvoľte čas',
+ timeText: 'Čas',
+ hourText: 'Hodiny',
+ minuteText: 'Minúty',
+ secondText: 'Sekundy',
+ millisecText: 'Milisekundy',
+ microsecText: 'Mikrosekundy',
+ timezoneText: 'Časové pásmo',
+ currentText: 'Teraz',
+ closeText: 'Zavrieť',
+ timeFormat: 'H:m',
+ timeSuffix: '',
+ amNames: ['dop.', 'AM', 'A'],
+ pmNames: ['pop.', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-sl.js
+/* Slovenian translation for the jQuery Timepicker Addon */
+/* Written by Hadalin (https://github.com/hadalin) */
+
+ $.timepicker.regional['sl'] = {
+ timeOnlyTitle: 'Izberite čas',
+ timeText: 'Čas',
+ hourText: 'Ura',
+ minuteText: 'Minute',
+ secondText: 'Sekunde',
+ millisecText: 'Milisekunde',
+ microsecText: 'Mikrosekunde',
+ timezoneText: 'Časovni pas',
+ currentText: 'Sedaj',
+ closeText: 'Zapri',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['dop.', 'AM', 'A'],
+ pmNames: ['pop.', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-sq.js
+/* Albanian translation for the jQuery Timepicker Addon */
+/* Written by Olti Buzi */
+
+ $.timepicker.regional['sq'] = {
+ timeOnlyTitle: 'Zgjidh orarin',
+ timeText: 'Orari',
+ hourText: 'Ora',
+ minuteText: 'Minuta',
+ secondText: 'Sekonda',
+ millisecText: 'Minisekonda',
+ microsecText: 'Mikrosekonda',
+ timezoneText: 'Zona kohore',
+ currentText: 'Tani',
+ closeText: 'Mbyll',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['m.', 'AM', 'A'],
+ pmNames: ['p.', 'PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-sr-RS.js
+/* Serbian cyrilic translation for the jQuery Timepicker Addon */
+/* Written by Vladimir Jelovac */
+
+ $.timepicker.regional['sr-RS'] = {
+ timeOnlyTitle: 'Одаберите време',
+ timeText: 'Време',
+ hourText: 'Сати',
+ minuteText: 'Минути',
+ secondText: 'Секунде',
+ millisecText: 'Милисекунде',
+ microsecText: 'Микросекунде',
+ timezoneText: 'Временска зона',
+ currentText: 'Сада',
+ closeText: 'Затвори',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-sr-YU.js
+/* Serbian latin translation for the jQuery Timepicker Addon */
+/* Written by Vladimir Jelovac */
+
+ $.timepicker.regional['sr-YU'] = {
+ timeOnlyTitle: 'Odaberite vreme',
+ timeText: 'Vreme',
+ hourText: 'Sati',
+ minuteText: 'Minuti',
+ secondText: 'Sekunde',
+ millisecText: 'Milisekunde',
+ microsecText: 'Mikrosekunde',
+ timezoneText: 'Vremenska zona',
+ currentText: 'Sada',
+ closeText: 'Zatvori',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-sv.js
+/* Swedish translation for the jQuery Timepicker Addon */
+/* Written by Nevon */
+
+ $.timepicker.regional['sv'] = {
+ timeOnlyTitle: 'Välj en tid',
+ timeText: 'Tid',
+ hourText: 'Timme',
+ minuteText: 'Minut',
+ secondText: 'Sekund',
+ millisecText: 'Millisekund',
+ microsecText: 'Mikrosekund',
+ timezoneText: 'Tidszon',
+ currentText: 'Nu',
+ closeText: 'Stäng',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-th.js
+/* Thai translation for the jQuery Timepicker Addon */
+/* Written by Yote Wachirapornpongsa */
+
+ $.timepicker.regional['th'] = {
+ timeOnlyTitle: 'เลือกเวลา',
+ timeText: 'เวลา ',
+ hourText: 'ชั่วโมง ',
+ minuteText: 'นาที',
+ secondText: 'วินาที',
+ millisecText: 'มิลลิวินาที',
+ microsecText: 'ไมโคริวินาที',
+ timezoneText: 'เขตเวลา',
+ currentText: 'เวลาปัจจุบัน',
+ closeText: 'ปิด',
+ timeFormat: 'hh:mm tt',
+ timeSuffix: ''
+ };
+
+// source: src/i18n/jquery-ui-timepicker-tr.js
+/* Turkish translation for the jQuery Timepicker Addon */
+/* Written by Fehmi Can Saglam, Edited by Goktug Ozturk */
+
+ $.timepicker.regional['tr'] = {
+ timeOnlyTitle: 'Zaman Seçiniz',
+ timeText: 'Zaman',
+ hourText: 'Saat',
+ minuteText: 'Dakika',
+ secondText: 'Saniye',
+ millisecText: 'Milisaniye',
+ microsecText: 'Mikrosaniye',
+ timezoneText: 'Zaman Dilimi',
+ currentText: 'Şu an',
+ closeText: 'Tamam',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['ÖÖ', 'Ö'],
+ pmNames: ['ÖS', 'S'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-uk.js
+/* Ukrainian translation for the jQuery Timepicker Addon */
+/* Written by Sergey Noskov */
+
+ $.timepicker.regional['uk'] = {
+ timeOnlyTitle: 'Виберіть час',
+ timeText: 'Час',
+ hourText: 'Години',
+ minuteText: 'Хвилини',
+ secondText: 'Секунди',
+ millisecText: 'Мілісекунди',
+ microsecText: 'Мікросекунди',
+ timezoneText: 'Часовий пояс',
+ currentText: 'Зараз',
+ closeText: 'Закрити',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-vi.js
+/* Vietnamese translation for the jQuery Timepicker Addon */
+/* Written by Nguyen Dinh Trung */
+
+ $.timepicker.regional['vi'] = {
+ timeOnlyTitle: 'Chọn giờ',
+ timeText: 'Thời gian',
+ hourText: 'Giờ',
+ minuteText: 'Phút',
+ secondText: 'Giây',
+ millisecText: 'Mili giây',
+ microsecText: 'Micrô giây',
+ timezoneText: 'Múi giờ',
+ currentText: 'Hiện thời',
+ closeText: 'Đóng',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['SA', 'S'],
+ pmNames: ['CH', 'C'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-zh-CN.js
+/* Simplified Chinese translation for the jQuery Timepicker Addon /
+/ Written by Will Lu */
+
+ $.timepicker.regional['zh-CN'] = {
+ timeOnlyTitle: '选择时间',
+ timeText: '时间',
+ hourText: '小时',
+ minuteText: '分钟',
+ secondText: '秒钟',
+ millisecText: '毫秒',
+ microsecText: '微秒',
+ timezoneText: '时区',
+ currentText: '现在时间',
+ closeText: '关闭',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+
+// source: src/i18n/jquery-ui-timepicker-zh-TW.js
+/* Chinese translation for the jQuery Timepicker Addon */
+/* Written by Alang.lin */
+
+ $.timepicker.regional['zh-TW'] = {
+ timeOnlyTitle: '選擇時分秒',
+ timeText: '時間',
+ hourText: '時',
+ minuteText: '分',
+ secondText: '秒',
+ millisecText: '毫秒',
+ microsecText: '微秒',
+ timezoneText: '時區',
+ currentText: '現在時間',
+ closeText: '確定',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['上午', 'AM', 'A'],
+ pmNames: ['下午', 'PM', 'P'],
+ isRTL: false
+ };
+
+})(jQuery);
diff --git a/dist/i18n/jquery-ui-timepicker-addon-i18n.min.js b/dist/i18n/jquery-ui-timepicker-addon-i18n.min.js
new file mode 100644
index 0000000..0f6f4be
--- /dev/null
+++ b/dist/i18n/jquery-ui-timepicker-addon-i18n.min.js
@@ -0,0 +1,4 @@
+/*! jQuery Timepicker Addon - v1.6.3 - 2016-04-20
+* http://trentrichardson.com/examples/timepicker
+* Copyright (c) 2016 Trent Richardson; Licensed MIT */
+!function(a){a.timepicker.regional.af={timeOnlyTitle:"Kies Tyd",timeText:"Tyd ",hourText:"Ure ",minuteText:"Minute",secondText:"Sekondes",millisecText:"Millisekondes",microsecText:"Mikrosekondes",timezoneText:"Tydsone",currentText:"Huidige Tyd",closeText:"Klaar",timeFormat:"HH:mm",timeSuffix:"",amNames:["AM","A"],pmNames:["PM","P"],isRTL:!1},a.timepicker.regional.am={timeOnlyTitle:"Ընտրեք ժամանակը",timeText:"Ժամանակը",hourText:"Ժամ",minuteText:"Րոպե",secondText:"Վարկյան",millisecText:"Միլիվարկյան",microsecText:"Միկրովարկյան",timezoneText:"Ժամային գոտին",currentText:"Այժմ",closeText:"Փակել",timeFormat:"HH:mm",timeSuffix:"",amNames:["AM","A"],pmNames:["PM","P"],isRTL:!1},a.timepicker.regional.bg={timeOnlyTitle:"Изберете време",timeText:"Време",hourText:"Час",minuteText:"Минути",secondText:"Секунди",millisecText:"Милисекунди",microsecText:"Микросекунди",timezoneText:"Часови пояс",currentText:"Сега",closeText:"Затвори",timeFormat:"HH:mm",timeSuffix:"",amNames:["AM","A"],pmNames:["PM","P"],isRTL:!1},a.timepicker.regional.ca={timeOnlyTitle:"Escollir una hora",timeText:"Hora",hourText:"Hores",minuteText:"Minuts",secondText:"Segons",millisecText:"Milisegons",microsecText:"Microsegons",timezoneText:"Fus horari",currentText:"Ara",closeText:"Tancar",timeFormat:"HH:mm",timeSuffix:"",amNames:["AM","A"],pmNames:["PM","P"],isRTL:!1},a.timepicker.regional.cs={timeOnlyTitle:"Vyberte čas",timeText:"Čas",hourText:"Hodiny",minuteText:"Minuty",secondText:"Vteřiny",millisecText:"Milisekundy",microsecText:"Mikrosekundy",timezoneText:"Časové pásmo",currentText:"Nyní",closeText:"Zavřít",timeFormat:"HH:mm",timeSuffix:"",amNames:["dop.","AM","A"],pmNames:["odp.","PM","P"],isRTL:!1},a.timepicker.regional.da={timeOnlyTitle:"Vælg tid",timeText:"Tid",hourText:"Time",minuteText:"Minut",secondText:"Sekund",millisecText:"Millisekund",microsecText:"Mikrosekund",timezoneText:"Tidszone",currentText:"Nu",closeText:"Luk",timeFormat:"HH:mm",timeSuffix:"",amNames:["am","AM","A"],pmNames:["pm","PM","P"],isRTL:!1},a.timepicker.regional.de={timeOnlyTitle:"Zeit wählen",timeText:"Zeit",hourText:"Stunde",minuteText:"Minute",secondText:"Sekunde",millisecText:"Millisekunde",microsecText:"Mikrosekunde",timezoneText:"Zeitzone",currentText:"Jetzt",closeText:"Fertig",timeFormat:"HH:mm",timeSuffix:"",amNames:["vorm.","AM","A"],pmNames:["nachm.","PM","P"],isRTL:!1},a.timepicker.regional.el={timeOnlyTitle:"Επιλογή ώρας",timeText:"Ώρα",hourText:"Ώρες",minuteText:"Λεπτά",secondText:"Δευτερόλεπτα",millisecText:"Χιλιοστοδευτερόλεπτα",microsecText:"Μικροδευτερόλεπτα",timezoneText:"Ζώνη ώρας",currentText:"Τώρα",closeText:"Κλείσιμο",timeFormat:"HH:mm",timeSuffix:"",amNames:["π.μ.","AM","A"],pmNames:["μ.μ.","PM","P"],isRTL:!1},a.timepicker.regional.es={timeOnlyTitle:"Elegir una hora",timeText:"Hora",hourText:"Horas",minuteText:"Minutos",secondText:"Segundos",millisecText:"Milisegundos",microsecText:"Microsegundos",timezoneText:"Uso horario",currentText:"Hoy",closeText:"Cerrar",timeFormat:"HH:mm",timeSuffix:"",amNames:["a.m.","AM","A"],pmNames:["p.m.","PM","P"],isRTL:!1},a.timepicker.regional.et={timeOnlyTitle:"Vali aeg",timeText:"Aeg",hourText:"Tund",minuteText:"Minut",secondText:"Sekund",millisecText:"Millisekundis",microsecText:"Mikrosekundis",timezoneText:"Ajavöönd",currentText:"Praegu",closeText:"Valmis",timeFormat:"HH:mm",timeSuffix:"",amNames:["AM","A"],pmNames:["PM","P"],isRTL:!1},a.timepicker.regional.eu={timeOnlyTitle:"Aukeratu ordua",timeText:"Ordua",hourText:"Orduak",minuteText:"Minutuak",secondText:"Segundoak",millisecText:"Milisegundoak",microsecText:"Mikrosegundoak",timezoneText:"Ordu-eremua",currentText:"Orain",closeText:"Itxi",timeFormat:"HH:mm",timeSuffix:"",amNames:["a.m.","AM","A"],pmNames:["p.m.","PM","P"],isRTL:!1},a.timepicker.regional.fa={timeOnlyTitle:"انتخاب زمان",timeText:"زمان",hourText:"ساعت",minuteText:"دقیقه",secondText:"ثانیه",millisecText:"میلی ثانیه",microsecText:"میکرو ثانیه",timezoneText:"منطقه زمانی",currentText:"الان",closeText:"انتخاب",timeFormat:"HH:mm",timeSuffix:"",amNames:["قبل ظهر","AM","A"],pmNames:["بعد ظهر","PM","P"],isRTL:!0},a.timepicker.regional.fi={timeOnlyTitle:"Valitse aika",timeText:"Aika",hourText:"Tunti",minuteText:"Minuutti",secondText:"Sekunti",millisecText:"Millisekunnin",microsecText:"Mikrosekuntia",timezoneText:"Aikavyöhyke",currentText:"Nyt",closeText:"Sulje",timeFormat:"HH:mm",timeSuffix:"",amNames:["ap.","AM","A"],pmNames:["ip.","PM","P"],isRTL:!1},a.timepicker.regional.fr={timeOnlyTitle:"Choisir une heure",timeText:"Heure",hourText:"Heures",minuteText:"Minutes",secondText:"Secondes",millisecText:"Millisecondes",microsecText:"Microsecondes",timezoneText:"Fuseau horaire",currentText:"Maintenant",closeText:"Terminé",timeFormat:"HH:mm",timeSuffix:"",amNames:["AM","A"],pmNames:["PM","P"],isRTL:!1},a.timepicker.regional.gl={timeOnlyTitle:"Elixir unha hora",timeText:"Hora",hourText:"Horas",minuteText:"Minutos",secondText:"Segundos",millisecText:"Milisegundos",microsecText:"Microssegundos",timezoneText:"Fuso horario",currentText:"Agora",closeText:"Pechar",timeFormat:"HH:mm",timeSuffix:"",amNames:["a.m.","AM","A"],pmNames:["p.m.","PM","P"],isRTL:!1},a.timepicker.regional.he={timeOnlyTitle:"בחירת זמן",timeText:"שעה",hourText:"שעות",minuteText:"דקות",secondText:"שניות",millisecText:"אלפית השנייה",microsecText:"מיקרו",timezoneText:"אזור זמן",currentText:"עכשיו",closeText:"סגור",timeFormat:"HH:mm",timeSuffix:"",amNames:['לפנה"צ',"AM","A"],pmNames:['אחה"צ',"PM","P"],isRTL:!0},a.timepicker.regional.hr={timeOnlyTitle:"Odaberi vrijeme",timeText:"Vrijeme",hourText:"Sati",minuteText:"Minute",secondText:"Sekunde",millisecText:"Milisekunde",microsecText:"Mikrosekunde",timezoneText:"Vremenska zona",currentText:"Sada",closeText:"Gotovo",timeFormat:"HH:mm",timeSuffix:"",amNames:["a.m.","AM","A"],pmNames:["p.m.","PM","P"],isRTL:!1},a.timepicker.regional.hu={timeOnlyTitle:"Válasszon időpontot",timeText:"Idő",hourText:"Óra",minuteText:"Perc",secondText:"Másodperc",millisecText:"Milliszekundumos",microsecText:"Ezredmásodperc",timezoneText:"Időzóna",currentText:"Most",closeText:"Kész",timeFormat:"HH:mm",timeSuffix:"",amNames:["de.","AM","A"],pmNames:["du.","PM","P"],isRTL:!1},a.timepicker.regional.id={timeOnlyTitle:"Pilih Waktu",timeText:"Waktu",hourText:"Pukul",minuteText:"Menit",secondText:"Detik",millisecText:"Milidetik",microsecText:"Mikrodetik",timezoneText:"Zona Waktu",currentText:"Sekarang",closeText:"OK",timeFormat:"HH:mm",timeSuffix:"",amNames:["AM","A"],pmNames:["PM","P"],isRTL:!1},a.timepicker.regional.it={timeOnlyTitle:"Scegli orario",timeText:"Orario",hourText:"Ora",minuteText:"Minuti",secondText:"Secondi",millisecText:"Millisecondi",microsecText:"Microsecondi",timezoneText:"Fuso orario",currentText:"Adesso",closeText:"Chiudi",timeFormat:"HH:mm",timeSuffix:"",amNames:["m.","AM","A"],pmNames:["p.","PM","P"],isRTL:!1},a.timepicker.regional.ja={timeOnlyTitle:"時間を選択",timeText:"時間",hourText:"時",minuteText:"分",secondText:"秒",millisecText:"ミリ秒",microsecText:"マイクロ秒",timezoneText:"タイムゾーン",currentText:"現時刻",closeText:"閉じる",timeFormat:"HH:mm",timeSuffix:"",amNames:["午前","AM","A"],pmNames:["午後","PM","P"],isRTL:!1},a.timepicker.regional.ko={timeOnlyTitle:"시간 선택",timeText:"시간",hourText:"시",minuteText:"분",secondText:"초",millisecText:"밀리초",microsecText:"마이크로",timezoneText:"표준 시간대",currentText:"현재 시각",closeText:"닫기",timeFormat:"tt h:mm",timeSuffix:"",amNames:["오전","AM","A"],pmNames:["오후","PM","P"],isRTL:!1},a.timepicker.regional.lt={timeOnlyTitle:"Pasirinkite laiką",timeText:"Laikas",hourText:"Valandos",minuteText:"Minutės",secondText:"Sekundės",millisecText:"Milisekundės",microsecText:"Mikrosekundės",timezoneText:"Laiko zona",currentText:"Dabar",closeText:"Uždaryti",timeFormat:"HH:mm",timeSuffix:"",amNames:["priešpiet","AM","A"],pmNames:["popiet","PM","P"],isRTL:!1},a.timepicker.regional.lv={timeOnlyTitle:"Ievadiet laiku",timeText:"Laiks",hourText:"Stundas",minuteText:"Minūtes",secondText:"Sekundes",millisecText:"Milisekundes",microsecText:"Mikrosekundes",timezoneText:"Laika josla",currentText:"Tagad",closeText:"Aizvērt",timeFormat:"HH:mm",timeSuffix:"",amNames:["AM","AM","A"],pmNames:["PM","PM","P"],isRTL:!1},a.timepicker.regional.mk={timeOnlyTitle:"Одберете време",timeText:"Време",hourText:"Час",minuteText:"Минути",secondText:"Секунди",millisecText:"Милисекунди",microsecText:"Микросекунди",timezoneText:"Временска зона",currentText:"Сега",closeText:"Затвори",timeFormat:"HH:mm",timeSuffix:"",amNames:["AM","A"],pmNames:["PM","P"],isRTL:!1},a.timepicker.regional.nl={timeOnlyTitle:"Tijdstip",timeText:"Tijd",hourText:"Uur",minuteText:"Minuut",secondText:"Seconde",millisecText:"Milliseconde",microsecText:"Microseconde",timezoneText:"Tijdzone",currentText:"Vandaag",closeText:"Sluiten",timeFormat:"HH:mm",timeSuffix:"",amNames:["AM","A"],pmNames:["PM","P"],isRTL:!1},a.timepicker.regional.no={timeOnlyTitle:"Velg tid",timeText:"Tid",hourText:"Time",minuteText:"Minutt",secondText:"Sekund",millisecText:"Millisekund",microsecText:"mikrosekund",timezoneText:"Tidssone",currentText:"Nå",closeText:"Lukk",timeFormat:"HH:mm",timeSuffix:"",amNames:["am","AM","A"],pmNames:["pm","PM","P"],isRTL:!1},a.timepicker.regional.pl={timeOnlyTitle:"Wybierz godzinę",timeText:"Czas",hourText:"Godzina",minuteText:"Minuta",secondText:"Sekunda",millisecText:"Milisekunda",microsecText:"Mikrosekunda",timezoneText:"Strefa czasowa",currentText:"Teraz",closeText:"Gotowe",timeFormat:"HH:mm",timeSuffix:"",amNames:["AM","A"],pmNames:["PM","P"],isRTL:!1},a.timepicker.regional["pt-BR"]={timeOnlyTitle:"Escolha o horário",timeText:"Horário",hourText:"Hora",minuteText:"Minutos",secondText:"Segundos",millisecText:"Milissegundos",microsecText:"Microssegundos",timezoneText:"Fuso horário",currentText:"Agora",closeText:"Fechar",timeFormat:"HH:mm",timeSuffix:"",amNames:["a.m.","AM","A"],pmNames:["p.m.","PM","P"],isRTL:!1},a.timepicker.regional.pt={timeOnlyTitle:"Escolha uma hora",timeText:"Hora",hourText:"Horas",minuteText:"Minutos",secondText:"Segundos",millisecText:"Milissegundos",microsecText:"Microssegundos",timezoneText:"Fuso horário",currentText:"Agora",closeText:"Fechar",timeFormat:"HH:mm",timeSuffix:"",amNames:["a.m.","AM","A"],pmNames:["p.m.","PM","P"],isRTL:!1},a.timepicker.regional.ro={timeOnlyTitle:"Alegeţi o oră",timeText:"Timp",hourText:"Ore",minuteText:"Minute",secondText:"Secunde",millisecText:"Milisecunde",microsecText:"Microsecunde",timezoneText:"Fus orar",currentText:"Acum",closeText:"Închide",timeFormat:"HH:mm",timeSuffix:"",amNames:["AM","A"],pmNames:["PM","P"],isRTL:!1},a.timepicker.regional.ru={timeOnlyTitle:"Выберите время",timeText:"Время",hourText:"Часы",minuteText:"Минуты",secondText:"Секунды",millisecText:"Миллисекунды",microsecText:"Микросекунды",timezoneText:"Часовой пояс",currentText:"Сейчас",closeText:"Закрыть",timeFormat:"HH:mm",timeSuffix:"",amNames:["AM","A"],pmNames:["PM","P"],isRTL:!1},a.timepicker.regional.sk={timeOnlyTitle:"Zvoľte čas",timeText:"Čas",hourText:"Hodiny",minuteText:"Minúty",secondText:"Sekundy",millisecText:"Milisekundy",microsecText:"Mikrosekundy",timezoneText:"Časové pásmo",currentText:"Teraz",closeText:"Zavrieť",timeFormat:"H:m",timeSuffix:"",amNames:["dop.","AM","A"],pmNames:["pop.","PM","P"],isRTL:!1},a.timepicker.regional.sl={timeOnlyTitle:"Izberite čas",timeText:"Čas",hourText:"Ura",minuteText:"Minute",secondText:"Sekunde",millisecText:"Milisekunde",microsecText:"Mikrosekunde",timezoneText:"Časovni pas",currentText:"Sedaj",closeText:"Zapri",timeFormat:"HH:mm",timeSuffix:"",amNames:["dop.","AM","A"],pmNames:["pop.","PM","P"],isRTL:!1},a.timepicker.regional.sq={timeOnlyTitle:"Zgjidh orarin",timeText:"Orari",hourText:"Ora",minuteText:"Minuta",secondText:"Sekonda",millisecText:"Minisekonda",microsecText:"Mikrosekonda",timezoneText:"Zona kohore",currentText:"Tani",closeText:"Mbyll",timeFormat:"HH:mm",timeSuffix:"",amNames:["m.","AM","A"],pmNames:["p.","PM","P"],isRTL:!1},a.timepicker.regional["sr-RS"]={timeOnlyTitle:"Одаберите време",timeText:"Време",hourText:"Сати",minuteText:"Минути",secondText:"Секунде",millisecText:"Милисекунде",microsecText:"Микросекунде",timezoneText:"Временска зона",currentText:"Сада",closeText:"Затвори",timeFormat:"HH:mm",timeSuffix:"",amNames:["AM","A"],pmNames:["PM","P"],isRTL:!1},a.timepicker.regional["sr-YU"]={timeOnlyTitle:"Odaberite vreme",timeText:"Vreme",hourText:"Sati",minuteText:"Minuti",secondText:"Sekunde",millisecText:"Milisekunde",microsecText:"Mikrosekunde",timezoneText:"Vremenska zona",currentText:"Sada",closeText:"Zatvori",timeFormat:"HH:mm",timeSuffix:"",amNames:["AM","A"],pmNames:["PM","P"],isRTL:!1},a.timepicker.regional.sv={timeOnlyTitle:"Välj en tid",timeText:"Tid",hourText:"Timme",minuteText:"Minut",secondText:"Sekund",millisecText:"Millisekund",microsecText:"Mikrosekund",timezoneText:"Tidszon",currentText:"Nu",closeText:"Stäng",timeFormat:"HH:mm",timeSuffix:"",amNames:["AM","A"],pmNames:["PM","P"],isRTL:!1},a.timepicker.regional.th={timeOnlyTitle:"เลือกเวลา",timeText:"เวลา ",hourText:"ชั่วโมง ",minuteText:"นาที",secondText:"วินาที",millisecText:"มิลลิวินาที",microsecText:"ไมโคริวินาที",timezoneText:"เขตเวลา",currentText:"เวลาปัจจุบัน",closeText:"ปิด",timeFormat:"hh:mm tt",timeSuffix:""},a.timepicker.regional.tr={timeOnlyTitle:"Zaman Seçiniz",timeText:"Zaman",hourText:"Saat",minuteText:"Dakika",secondText:"Saniye",millisecText:"Milisaniye",microsecText:"Mikrosaniye",timezoneText:"Zaman Dilimi",currentText:"Şu an",closeText:"Tamam",timeFormat:"HH:mm",timeSuffix:"",amNames:["ÖÖ","Ö"],pmNames:["ÖS","S"],isRTL:!1},a.timepicker.regional.uk={timeOnlyTitle:"Виберіть час",timeText:"Час",hourText:"Години",minuteText:"Хвилини",secondText:"Секунди",millisecText:"Мілісекунди",microsecText:"Мікросекунди",timezoneText:"Часовий пояс",currentText:"Зараз",closeText:"Закрити",timeFormat:"HH:mm",timeSuffix:"",amNames:["AM","A"],pmNames:["PM","P"],isRTL:!1},a.timepicker.regional.vi={timeOnlyTitle:"Chọn giờ",timeText:"Thời gian",hourText:"Giờ",minuteText:"Phút",secondText:"Giây",millisecText:"Mili giây",microsecText:"Micrô giây",timezoneText:"Múi giờ",currentText:"Hiện thời",closeText:"Đóng",timeFormat:"HH:mm",timeSuffix:"",amNames:["SA","S"],pmNames:["CH","C"],isRTL:!1},a.timepicker.regional["zh-CN"]={timeOnlyTitle:"选择时间",timeText:"时间",hourText:"小时",minuteText:"分钟",secondText:"秒钟",millisecText:"毫秒",microsecText:"微秒",timezoneText:"时区",currentText:"现在时间",closeText:"关闭",timeFormat:"HH:mm",timeSuffix:"",amNames:["AM","A"],pmNames:["PM","P"],isRTL:!1},a.timepicker.regional["zh-TW"]={timeOnlyTitle:"選擇時分秒",timeText:"時間",hourText:"時",minuteText:"分",secondText:"秒",millisecText:"毫秒",microsecText:"微秒",timezoneText:"時區",currentText:"現在時間",closeText:"確定",timeFormat:"HH:mm",timeSuffix:"",amNames:["上午","AM","A"],pmNames:["下午","PM","P"],isRTL:!1}}(jQuery);
\ No newline at end of file
diff --git a/localization/jquery-ui-timepicker-af.js b/dist/i18n/jquery-ui-timepicker-af.js
similarity index 87%
rename from localization/jquery-ui-timepicker-af.js
rename to dist/i18n/jquery-ui-timepicker-af.js
index 6a6353e..8dbec3e 100644
--- a/localization/jquery-ui-timepicker-af.js
+++ b/dist/i18n/jquery-ui-timepicker-af.js
@@ -8,10 +8,12 @@
minuteText: 'Minute',
secondText: 'Sekondes',
millisecText: 'Millisekondes',
+ microsecText: 'Mikrosekondes',
timezoneText: 'Tydsone',
currentText: 'Huidige Tyd',
closeText: 'Klaar',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
isRTL: false
diff --git a/dist/i18n/jquery-ui-timepicker-am.js b/dist/i18n/jquery-ui-timepicker-am.js
new file mode 100644
index 0000000..676c8b9
--- /dev/null
+++ b/dist/i18n/jquery-ui-timepicker-am.js
@@ -0,0 +1,22 @@
+/* Armenian translation for the jQuery Timepicker Addon */
+/* Written by Artavazd Avetisyan artavazda@hotmail.com */
+(function($) {
+ $.timepicker.regional['am'] = {
+ timeOnlyTitle: 'Ընտրեք ժամանակը',
+ timeText: 'Ժամանակը',
+ hourText: 'Ժամ',
+ minuteText: 'Րոպե',
+ secondText: 'Վարկյան',
+ millisecText: 'Միլիվարկյան',
+ microsecText: 'Միկրովարկյան',
+ timezoneText: 'Ժամային գոտին',
+ currentText: 'Այժմ',
+ closeText: 'Փակել',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+ $.timepicker.setDefaults($.timepicker.regional['am']);
+})(jQuery);
diff --git a/localization/jquery-ui-timepicker-bg.js b/dist/i18n/jquery-ui-timepicker-bg.js
similarity index 90%
rename from localization/jquery-ui-timepicker-bg.js
rename to dist/i18n/jquery-ui-timepicker-bg.js
index ffc0cea..58f076e 100644
--- a/localization/jquery-ui-timepicker-bg.js
+++ b/dist/i18n/jquery-ui-timepicker-bg.js
@@ -8,10 +8,12 @@
minuteText: 'Минути',
secondText: 'Секунди',
millisecText: 'Милисекунди',
+ microsecText: 'Микросекунди',
timezoneText: 'Часови пояс',
currentText: 'Сега',
closeText: 'Затвори',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-ca.js b/dist/i18n/jquery-ui-timepicker-ca.js
similarity index 91%
rename from localization/jquery-ui-timepicker-ca.js
rename to dist/i18n/jquery-ui-timepicker-ca.js
index e3c771d..84fa00e 100644
--- a/localization/jquery-ui-timepicker-ca.js
+++ b/dist/i18n/jquery-ui-timepicker-ca.js
@@ -8,10 +8,12 @@
minuteText: 'Minuts',
secondText: 'Segons',
millisecText: 'Milisegons',
+ microsecText: 'Microsegons',
timezoneText: 'Fus horari',
currentText: 'Ara',
closeText: 'Tancar',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-cs.js b/dist/i18n/jquery-ui-timepicker-cs.js
similarity index 91%
rename from localization/jquery-ui-timepicker-cs.js
rename to dist/i18n/jquery-ui-timepicker-cs.js
index 814dd94..26d6ec7 100644
--- a/localization/jquery-ui-timepicker-cs.js
+++ b/dist/i18n/jquery-ui-timepicker-cs.js
@@ -8,10 +8,12 @@
minuteText: 'Minuty',
secondText: 'Vteřiny',
millisecText: 'Milisekundy',
+ microsecText: 'Mikrosekundy',
timezoneText: 'Časové pásmo',
currentText: 'Nyní',
closeText: 'Zavřít',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['dop.', 'AM', 'A'],
pmNames: ['odp.', 'PM', 'P'],
isRTL: false
diff --git a/dist/i18n/jquery-ui-timepicker-da.js b/dist/i18n/jquery-ui-timepicker-da.js
new file mode 100644
index 0000000..5d8072b
--- /dev/null
+++ b/dist/i18n/jquery-ui-timepicker-da.js
@@ -0,0 +1,22 @@
+/* Danish translation for the jQuery Timepicker Addon */
+/* Written by Lars H. Jensen (http://www.larshj.dk) */
+(function ($) {
+ $.timepicker.regional['da'] = {
+ timeOnlyTitle: 'Vælg tid',
+ timeText: 'Tid',
+ hourText: 'Time',
+ minuteText: 'Minut',
+ secondText: 'Sekund',
+ millisecText: 'Millisekund',
+ microsecText: 'Mikrosekund',
+ timezoneText: 'Tidszone',
+ currentText: 'Nu',
+ closeText: 'Luk',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['am', 'AM', 'A'],
+ pmNames: ['pm', 'PM', 'P'],
+ isRTL: false
+ };
+ $.timepicker.setDefaults($.timepicker.regional['da']);
+})(jQuery);
diff --git a/localization/jquery-ui-timepicker-de.js b/dist/i18n/jquery-ui-timepicker-de.js
similarity index 85%
rename from localization/jquery-ui-timepicker-de.js
rename to dist/i18n/jquery-ui-timepicker-de.js
index 1a998a0..90c33af 100644
--- a/localization/jquery-ui-timepicker-de.js
+++ b/dist/i18n/jquery-ui-timepicker-de.js
@@ -2,16 +2,18 @@
/* Written by Marvin */
(function($) {
$.timepicker.regional['de'] = {
- timeOnlyTitle: 'Zeit Wählen',
+ timeOnlyTitle: 'Zeit wählen',
timeText: 'Zeit',
hourText: 'Stunde',
minuteText: 'Minute',
secondText: 'Sekunde',
millisecText: 'Millisekunde',
+ microsecText: 'Mikrosekunde',
timezoneText: 'Zeitzone',
currentText: 'Jetzt',
closeText: 'Fertig',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['vorm.', 'AM', 'A'],
pmNames: ['nachm.', 'PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-el.js b/dist/i18n/jquery-ui-timepicker-el.js
similarity index 79%
rename from localization/jquery-ui-timepicker-el.js
rename to dist/i18n/jquery-ui-timepicker-el.js
index 9109afd..72aec6d 100644
--- a/localization/jquery-ui-timepicker-el.js
+++ b/dist/i18n/jquery-ui-timepicker-el.js
@@ -7,14 +7,16 @@
hourText: 'Ώρες',
minuteText: 'Λεπτά',
secondText: 'Δευτερόλεπτα',
- millisecText: 'μιλιδευτερόλεπτο',
+ millisecText: 'Χιλιοστοδευτερόλεπτα',
+ microsecText: 'Μικροδευτερόλεπτα',
timezoneText: 'Ζώνη ώρας',
currentText: 'Τώρα',
closeText: 'Κλείσιμο',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['π.μ.', 'AM', 'A'],
pmNames: ['μ.μ.', 'PM', 'P'],
isRTL: false
};
$.timepicker.setDefaults($.timepicker.regional['el']);
-})(jQuery);
+})(jQuery);
\ No newline at end of file
diff --git a/localization/jquery-ui-timepicker-es.js b/dist/i18n/jquery-ui-timepicker-es.js
similarity index 78%
rename from localization/jquery-ui-timepicker-es.js
rename to dist/i18n/jquery-ui-timepicker-es.js
index c446c1c..b19ba11 100644
--- a/localization/jquery-ui-timepicker-es.js
+++ b/dist/i18n/jquery-ui-timepicker-es.js
@@ -1,5 +1,6 @@
/* Spanish translation for the jQuery Timepicker Addon */
/* Written by Ianaré Sévi */
+/* Modified by Carlos Martínez */
(function($) {
$.timepicker.regional['es'] = {
timeOnlyTitle: 'Elegir una hora',
@@ -8,10 +9,12 @@
minuteText: 'Minutos',
secondText: 'Segundos',
millisecText: 'Milisegundos',
- timezoneText: 'Huso horario',
- currentText: 'Ahora',
+ microsecText: 'Microsegundos',
+ timezoneText: 'Uso horario',
+ currentText: 'Hoy',
closeText: 'Cerrar',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['a.m.', 'AM', 'A'],
pmNames: ['p.m.', 'PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-et.js b/dist/i18n/jquery-ui-timepicker-et.js
similarity index 91%
rename from localization/jquery-ui-timepicker-et.js
rename to dist/i18n/jquery-ui-timepicker-et.js
index a3a4f10..b2bb766 100644
--- a/localization/jquery-ui-timepicker-et.js
+++ b/dist/i18n/jquery-ui-timepicker-et.js
@@ -8,10 +8,12 @@
minuteText: 'Minut',
secondText: 'Sekund',
millisecText: 'Millisekundis',
+ microsecText: 'Mikrosekundis',
timezoneText: 'Ajavöönd',
currentText: 'Praegu',
closeText: 'Valmis',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-eu.js b/dist/i18n/jquery-ui-timepicker-eu.js
similarity index 65%
rename from localization/jquery-ui-timepicker-eu.js
rename to dist/i18n/jquery-ui-timepicker-eu.js
index 7b1c510..7e0c0f3 100644
--- a/localization/jquery-ui-timepicker-eu.js
+++ b/dist/i18n/jquery-ui-timepicker-eu.js
@@ -1,17 +1,20 @@
-/* Basque trannslation for JQuery Timepicker Addon
+/* Basque trannslation for JQuery Timepicker Addon */
/* Translated by Xabi Fer */
+/* Fixed by Asier Iturralde Sarasola - iametza interaktiboa */
(function($) {
$.timepicker.regional['eu'] = {
timeOnlyTitle: 'Aukeratu ordua',
timeText: 'Ordua',
hourText: 'Orduak',
minuteText: 'Minutuak',
- secondText: 'Segunduak',
- millisecText: 'Milisegunduak',
+ secondText: 'Segundoak',
+ millisecText: 'Milisegundoak',
+ microsecText: 'Mikrosegundoak',
timezoneText: 'Ordu-eremua',
currentText: 'Orain',
closeText: 'Itxi',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['a.m.', 'AM', 'A'],
pmNames: ['p.m.', 'PM', 'P'],
isRTL: false
diff --git a/dist/i18n/jquery-ui-timepicker-fa.js b/dist/i18n/jquery-ui-timepicker-fa.js
new file mode 100644
index 0000000..25e2403
--- /dev/null
+++ b/dist/i18n/jquery-ui-timepicker-fa.js
@@ -0,0 +1,22 @@
+/* Persian translation for the jQuery Timepicker Addon */
+/* Written by Meysam Pour Ganji */
+(function($) {
+ $.timepicker.regional['fa'] = {
+ timeOnlyTitle: 'انتخاب زمان',
+ timeText: 'زمان',
+ hourText: 'ساعت',
+ minuteText: 'دقیقه',
+ secondText: 'ثانیه',
+ millisecText: 'میلی ثانیه',
+ microsecText: 'میکرو ثانیه',
+ timezoneText: 'منطقه زمانی',
+ currentText: 'الان',
+ closeText: 'انتخاب',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['قبل ظهر', 'AM', 'A'],
+ pmNames: ['بعد ظهر', 'PM', 'P'],
+ isRTL: true
+ };
+ $.timepicker.setDefaults($.timepicker.regional['fa']);
+})(jQuery);
diff --git a/localization/jquery-ui-timepicker-fi.js b/dist/i18n/jquery-ui-timepicker-fi.js
similarity index 91%
rename from localization/jquery-ui-timepicker-fi.js
rename to dist/i18n/jquery-ui-timepicker-fi.js
index 12be648..4493d4c 100644
--- a/localization/jquery-ui-timepicker-fi.js
+++ b/dist/i18n/jquery-ui-timepicker-fi.js
@@ -8,10 +8,12 @@
minuteText: 'Minuutti',
secondText: 'Sekunti',
millisecText: 'Millisekunnin',
+ microsecText: 'Mikrosekuntia',
timezoneText: 'Aikavyöhyke',
currentText: 'Nyt',
closeText: 'Sulje',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['ap.', 'AM', 'A'],
pmNames: ['ip.', 'PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-fr.js b/dist/i18n/jquery-ui-timepicker-fr.js
similarity index 91%
rename from localization/jquery-ui-timepicker-fr.js
rename to dist/i18n/jquery-ui-timepicker-fr.js
index 805b72d..0002517 100644
--- a/localization/jquery-ui-timepicker-fr.js
+++ b/dist/i18n/jquery-ui-timepicker-fr.js
@@ -8,10 +8,12 @@
minuteText: 'Minutes',
secondText: 'Secondes',
millisecText: 'Millisecondes',
+ microsecText: 'Microsecondes',
timezoneText: 'Fuseau horaire',
currentText: 'Maintenant',
closeText: 'Terminé',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-gl.js b/dist/i18n/jquery-ui-timepicker-gl.js
similarity index 91%
rename from localization/jquery-ui-timepicker-gl.js
rename to dist/i18n/jquery-ui-timepicker-gl.js
index 4ed889b..4b9501f 100644
--- a/localization/jquery-ui-timepicker-gl.js
+++ b/dist/i18n/jquery-ui-timepicker-gl.js
@@ -8,10 +8,12 @@
minuteText: 'Minutos',
secondText: 'Segundos',
millisecText: 'Milisegundos',
+ microsecText: 'Microssegundos',
timezoneText: 'Fuso horario',
currentText: 'Agora',
closeText: 'Pechar',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['a.m.', 'AM', 'A'],
pmNames: ['p.m.', 'PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-he.js b/dist/i18n/jquery-ui-timepicker-he.js
similarity index 92%
rename from localization/jquery-ui-timepicker-he.js
rename to dist/i18n/jquery-ui-timepicker-he.js
index a887fbb..9b78cbd 100644
--- a/localization/jquery-ui-timepicker-he.js
+++ b/dist/i18n/jquery-ui-timepicker-he.js
@@ -8,10 +8,12 @@
minuteText: "דקות",
secondText: "שניות",
millisecText: "אלפית השנייה",
+ microsecText: "מיקרו",
timezoneText: "אזור זמן",
currentText: "עכשיו",
closeText:"סגור",
timeFormat: "HH:mm",
+ timeSuffix: '',
amNames: ['לפנה"צ', 'AM', 'A'],
pmNames: ['אחה"צ', 'PM', 'P'],
isRTL: true
diff --git a/dist/i18n/jquery-ui-timepicker-hr.js b/dist/i18n/jquery-ui-timepicker-hr.js
new file mode 100644
index 0000000..b60f89a
--- /dev/null
+++ b/dist/i18n/jquery-ui-timepicker-hr.js
@@ -0,0 +1,22 @@
+/* Croatian translation for the jQuery Timepicker Addon */
+/* Written by Mladen */
+(function($) {
+ $.timepicker.regional['hr'] = {
+ timeOnlyTitle: 'Odaberi vrijeme',
+ timeText: 'Vrijeme',
+ hourText: 'Sati',
+ minuteText: 'Minute',
+ secondText: 'Sekunde',
+ millisecText: 'Milisekunde',
+ microsecText: 'Mikrosekunde',
+ timezoneText: 'Vremenska zona',
+ currentText: 'Sada',
+ closeText: 'Gotovo',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['a.m.', 'AM', 'A'],
+ pmNames: ['p.m.', 'PM', 'P'],
+ isRTL: false
+ };
+ $.timepicker.setDefaults($.timepicker.regional['hr']);
+})(jQuery);
\ No newline at end of file
diff --git a/localization/jquery-ui-timepicker-hu.js b/dist/i18n/jquery-ui-timepicker-hu.js
similarity index 91%
rename from localization/jquery-ui-timepicker-hu.js
rename to dist/i18n/jquery-ui-timepicker-hu.js
index 1adb8a9..6bdb0f4 100644
--- a/localization/jquery-ui-timepicker-hu.js
+++ b/dist/i18n/jquery-ui-timepicker-hu.js
@@ -8,10 +8,12 @@
minuteText: 'Perc',
secondText: 'Másodperc',
millisecText: 'Milliszekundumos',
+ microsecText: 'Ezredmásodperc',
timezoneText: 'Időzóna',
currentText: 'Most',
closeText: 'Kész',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['de.', 'AM', 'A'],
pmNames: ['du.', 'PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-id.js b/dist/i18n/jquery-ui-timepicker-id.js
similarity index 91%
rename from localization/jquery-ui-timepicker-id.js
rename to dist/i18n/jquery-ui-timepicker-id.js
index 6c0e858..9f21f50 100644
--- a/localization/jquery-ui-timepicker-id.js
+++ b/dist/i18n/jquery-ui-timepicker-id.js
@@ -8,10 +8,12 @@
minuteText: 'Menit',
secondText: 'Detik',
millisecText: 'Milidetik',
+ microsecText: 'Mikrodetik',
timezoneText: 'Zona Waktu',
currentText: 'Sekarang',
closeText: 'OK',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-it.js b/dist/i18n/jquery-ui-timepicker-it.js
similarity index 77%
rename from localization/jquery-ui-timepicker-it.js
rename to dist/i18n/jquery-ui-timepicker-it.js
index 70124fd..540f41a 100644
--- a/localization/jquery-ui-timepicker-it.js
+++ b/dist/i18n/jquery-ui-timepicker-it.js
@@ -5,13 +5,15 @@
timeOnlyTitle: 'Scegli orario',
timeText: 'Orario',
hourText: 'Ora',
- minuteText: 'Minuto',
- secondText: 'Secondo',
- millisecText: 'Millisecondo',
+ minuteText: 'Minuti',
+ secondText: 'Secondi',
+ millisecText: 'Millisecondi',
+ microsecText: 'Microsecondi',
timezoneText: 'Fuso orario',
currentText: 'Adesso',
closeText: 'Chiudi',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['m.', 'AM', 'A'],
pmNames: ['p.', 'PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-ja.js b/dist/i18n/jquery-ui-timepicker-ja.js
similarity index 91%
rename from localization/jquery-ui-timepicker-ja.js
rename to dist/i18n/jquery-ui-timepicker-ja.js
index 42d8114..cd3f020 100644
--- a/localization/jquery-ui-timepicker-ja.js
+++ b/dist/i18n/jquery-ui-timepicker-ja.js
@@ -8,10 +8,12 @@
minuteText: '分',
secondText: '秒',
millisecText: 'ミリ秒',
+ microsecText: 'マイクロ秒',
timezoneText: 'タイムゾーン',
currentText: '現時刻',
closeText: '閉じる',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['午前', 'AM', 'A'],
pmNames: ['午後', 'PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-ko.js b/dist/i18n/jquery-ui-timepicker-ko.js
similarity index 91%
rename from localization/jquery-ui-timepicker-ko.js
rename to dist/i18n/jquery-ui-timepicker-ko.js
index 7fe6c47..ca85b88 100644
--- a/localization/jquery-ui-timepicker-ko.js
+++ b/dist/i18n/jquery-ui-timepicker-ko.js
@@ -8,10 +8,12 @@
minuteText: '분',
secondText: '초',
millisecText: '밀리초',
+ microsecText: '마이크로',
timezoneText: '표준 시간대',
currentText: '현재 시각',
closeText: '닫기',
timeFormat: 'tt h:mm',
+ timeSuffix: '',
amNames: ['오전', 'AM', 'A'],
pmNames: ['오후', 'PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-lt.js b/dist/i18n/jquery-ui-timepicker-lt.js
similarity index 91%
rename from localization/jquery-ui-timepicker-lt.js
rename to dist/i18n/jquery-ui-timepicker-lt.js
index 4ec3eeb..97d2b8b 100644
--- a/localization/jquery-ui-timepicker-lt.js
+++ b/dist/i18n/jquery-ui-timepicker-lt.js
@@ -8,10 +8,12 @@
minuteText: 'Minutės',
secondText: 'Sekundės',
millisecText: 'Milisekundės',
+ microsecText: 'Mikrosekundės',
timezoneText: 'Laiko zona',
currentText: 'Dabar',
closeText: 'Uždaryti',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['priešpiet', 'AM', 'A'],
pmNames: ['popiet', 'PM', 'P'],
isRTL: false
diff --git a/dist/i18n/jquery-ui-timepicker-lv.js b/dist/i18n/jquery-ui-timepicker-lv.js
new file mode 100644
index 0000000..0cbd6e6
--- /dev/null
+++ b/dist/i18n/jquery-ui-timepicker-lv.js
@@ -0,0 +1,22 @@
+/* Latvian translation for the jQuery Timepicker Addon */
+/* Written by Dmitry Bogatykh */
+(function($) {
+ $.timepicker.regional['lv'] = {
+ timeOnlyTitle: 'Ievadiet laiku',
+ timeText: 'Laiks',
+ hourText: 'Stundas',
+ minuteText: 'Minūtes',
+ secondText: 'Sekundes',
+ millisecText: 'Milisekundes',
+ microsecText: 'Mikrosekundes',
+ timezoneText: 'Laika josla',
+ currentText: 'Tagad',
+ closeText: 'Aizvērt',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'AM', 'A'],
+ pmNames: ['PM', 'PM', 'P'],
+ isRTL: false
+ };
+ $.timepicker.setDefaults($.timepicker.regional['lv']);
+})(jQuery);
\ No newline at end of file
diff --git a/dist/i18n/jquery-ui-timepicker-mk.js b/dist/i18n/jquery-ui-timepicker-mk.js
new file mode 100644
index 0000000..9857e01
--- /dev/null
+++ b/dist/i18n/jquery-ui-timepicker-mk.js
@@ -0,0 +1,22 @@
+/* Macedonian cyrilic translation for the jQuery Timepicker Addon */
+/* Written by Vlatko Ristovski */
+(function($) {
+ $.timepicker.regional['mk'] = {
+ timeOnlyTitle: 'Одберете време',
+ timeText: 'Време',
+ hourText: 'Час',
+ minuteText: 'Минути',
+ secondText: 'Секунди',
+ millisecText: 'Милисекунди',
+ microsecText: 'Микросекунди',
+ timezoneText: 'Временска зона',
+ currentText: 'Сега',
+ closeText: 'Затвори',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+ $.timepicker.setDefaults($.timepicker.regional['mk']);
+})(jQuery);
\ No newline at end of file
diff --git a/localization/jquery-ui-timepicker-nl.js b/dist/i18n/jquery-ui-timepicker-nl.js
similarity index 91%
rename from localization/jquery-ui-timepicker-nl.js
rename to dist/i18n/jquery-ui-timepicker-nl.js
index eff496c..bc71fc1 100644
--- a/localization/jquery-ui-timepicker-nl.js
+++ b/dist/i18n/jquery-ui-timepicker-nl.js
@@ -8,10 +8,12 @@
minuteText: 'Minuut',
secondText: 'Seconde',
millisecText: 'Milliseconde',
+ microsecText: 'Microseconde',
timezoneText: 'Tijdzone',
currentText: 'Vandaag',
closeText: 'Sluiten',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-no.js b/dist/i18n/jquery-ui-timepicker-no.js
similarity index 91%
rename from localization/jquery-ui-timepicker-no.js
rename to dist/i18n/jquery-ui-timepicker-no.js
index 8da6a1d..39f32fd 100644
--- a/localization/jquery-ui-timepicker-no.js
+++ b/dist/i18n/jquery-ui-timepicker-no.js
@@ -8,10 +8,12 @@
minuteText: 'Minutt',
secondText: 'Sekund',
millisecText: 'Millisekund',
+ microsecText: 'mikrosekund',
timezoneText: 'Tidssone',
currentText: 'Nå',
closeText: 'Lukk',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['am', 'AM', 'A'],
pmNames: ['pm', 'PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-pl.js b/dist/i18n/jquery-ui-timepicker-pl.js
similarity index 91%
rename from localization/jquery-ui-timepicker-pl.js
rename to dist/i18n/jquery-ui-timepicker-pl.js
index 138b7d3..0a67a79 100644
--- a/localization/jquery-ui-timepicker-pl.js
+++ b/dist/i18n/jquery-ui-timepicker-pl.js
@@ -8,10 +8,12 @@
minuteText: 'Minuta',
secondText: 'Sekunda',
millisecText: 'Milisekunda',
+ microsecText: 'Mikrosekunda',
timezoneText: 'Strefa czasowa',
currentText: 'Teraz',
closeText: 'Gotowe',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-pt-BR.js b/dist/i18n/jquery-ui-timepicker-pt-BR.js
similarity index 86%
rename from localization/jquery-ui-timepicker-pt-BR.js
rename to dist/i18n/jquery-ui-timepicker-pt-BR.js
index cd9ee12..0ad06a3 100644
--- a/localization/jquery-ui-timepicker-pt-BR.js
+++ b/dist/i18n/jquery-ui-timepicker-pt-BR.js
@@ -2,16 +2,18 @@
/* Written by Diogo Damiani (diogodamiani@gmail.com) */
(function ($) {
$.timepicker.regional['pt-BR'] = {
- timeOnlyTitle: 'Escolha a horário',
+ timeOnlyTitle: 'Escolha o horário',
timeText: 'Horário',
hourText: 'Hora',
minuteText: 'Minutos',
secondText: 'Segundos',
millisecText: 'Milissegundos',
+ microsecText: 'Microssegundos',
timezoneText: 'Fuso horário',
currentText: 'Agora',
closeText: 'Fechar',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['a.m.', 'AM', 'A'],
pmNames: ['p.m.', 'PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-pt.js b/dist/i18n/jquery-ui-timepicker-pt.js
similarity index 91%
rename from localization/jquery-ui-timepicker-pt.js
rename to dist/i18n/jquery-ui-timepicker-pt.js
index 029926a..0aa792e 100644
--- a/localization/jquery-ui-timepicker-pt.js
+++ b/dist/i18n/jquery-ui-timepicker-pt.js
@@ -8,10 +8,12 @@
minuteText: 'Minutos',
secondText: 'Segundos',
millisecText: 'Milissegundos',
+ microsecText: 'Microssegundos',
timezoneText: 'Fuso horário',
currentText: 'Agora',
closeText: 'Fechar',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['a.m.', 'AM', 'A'],
pmNames: ['p.m.', 'PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-ro.js b/dist/i18n/jquery-ui-timepicker-ro.js
similarity index 91%
rename from localization/jquery-ui-timepicker-ro.js
rename to dist/i18n/jquery-ui-timepicker-ro.js
index 2b80a02..4f5f386 100644
--- a/localization/jquery-ui-timepicker-ro.js
+++ b/dist/i18n/jquery-ui-timepicker-ro.js
@@ -8,10 +8,12 @@
minuteText: 'Minute',
secondText: 'Secunde',
millisecText: 'Milisecunde',
+ microsecText: 'Microsecunde',
timezoneText: 'Fus orar',
currentText: 'Acum',
closeText: 'Închide',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-ru.js b/dist/i18n/jquery-ui-timepicker-ru.js
similarity index 90%
rename from localization/jquery-ui-timepicker-ru.js
rename to dist/i18n/jquery-ui-timepicker-ru.js
index 71ea9d5..b539a73 100644
--- a/localization/jquery-ui-timepicker-ru.js
+++ b/dist/i18n/jquery-ui-timepicker-ru.js
@@ -8,10 +8,12 @@
minuteText: 'Минуты',
secondText: 'Секунды',
millisecText: 'Миллисекунды',
+ microsecText: 'Микросекунды',
timezoneText: 'Часовой пояс',
currentText: 'Сейчас',
closeText: 'Закрыть',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-sk.js b/dist/i18n/jquery-ui-timepicker-sk.js
similarity index 91%
rename from localization/jquery-ui-timepicker-sk.js
rename to dist/i18n/jquery-ui-timepicker-sk.js
index 4b4042b..eee0d0b 100644
--- a/localization/jquery-ui-timepicker-sk.js
+++ b/dist/i18n/jquery-ui-timepicker-sk.js
@@ -8,10 +8,12 @@
minuteText: 'Minúty',
secondText: 'Sekundy',
millisecText: 'Milisekundy',
+ microsecText: 'Mikrosekundy',
timezoneText: 'Časové pásmo',
currentText: 'Teraz',
closeText: 'Zavrieť',
timeFormat: 'H:m',
+ timeSuffix: '',
amNames: ['dop.', 'AM', 'A'],
pmNames: ['pop.', 'PM', 'P'],
isRTL: false
diff --git a/dist/i18n/jquery-ui-timepicker-sl.js b/dist/i18n/jquery-ui-timepicker-sl.js
new file mode 100644
index 0000000..0906b10
--- /dev/null
+++ b/dist/i18n/jquery-ui-timepicker-sl.js
@@ -0,0 +1,22 @@
+/* Slovenian translation for the jQuery Timepicker Addon */
+/* Written by Hadalin (https://github.com/hadalin) */
+(function($) {
+ $.timepicker.regional['sl'] = {
+ timeOnlyTitle: 'Izberite čas',
+ timeText: 'Čas',
+ hourText: 'Ura',
+ minuteText: 'Minute',
+ secondText: 'Sekunde',
+ millisecText: 'Milisekunde',
+ microsecText: 'Mikrosekunde',
+ timezoneText: 'Časovni pas',
+ currentText: 'Sedaj',
+ closeText: 'Zapri',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['dop.', 'AM', 'A'],
+ pmNames: ['pop.', 'PM', 'P'],
+ isRTL: false
+ };
+ $.timepicker.setDefaults($.timepicker.regional['sl']);
+})(jQuery);
diff --git a/dist/i18n/jquery-ui-timepicker-sq.js b/dist/i18n/jquery-ui-timepicker-sq.js
new file mode 100644
index 0000000..d93d88c
--- /dev/null
+++ b/dist/i18n/jquery-ui-timepicker-sq.js
@@ -0,0 +1,22 @@
+/* Albanian translation for the jQuery Timepicker Addon */
+/* Written by Olti Buzi */
+(function($) {
+ $.timepicker.regional['sq'] = {
+ timeOnlyTitle: 'Zgjidh orarin',
+ timeText: 'Orari',
+ hourText: 'Ora',
+ minuteText: 'Minuta',
+ secondText: 'Sekonda',
+ millisecText: 'Minisekonda',
+ microsecText: 'Mikrosekonda',
+ timezoneText: 'Zona kohore',
+ currentText: 'Tani',
+ closeText: 'Mbyll',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['m.', 'AM', 'A'],
+ pmNames: ['p.', 'PM', 'P'],
+ isRTL: false
+ };
+ $.timepicker.setDefaults($.timepicker.regional['sq']);
+})(jQuery);
\ No newline at end of file
diff --git a/dist/i18n/jquery-ui-timepicker-sr-RS.js b/dist/i18n/jquery-ui-timepicker-sr-RS.js
new file mode 100644
index 0000000..79a9803
--- /dev/null
+++ b/dist/i18n/jquery-ui-timepicker-sr-RS.js
@@ -0,0 +1,22 @@
+/* Serbian cyrilic translation for the jQuery Timepicker Addon */
+/* Written by Vladimir Jelovac */
+(function($) {
+ $.timepicker.regional['sr-RS'] = {
+ timeOnlyTitle: 'Одаберите време',
+ timeText: 'Време',
+ hourText: 'Сати',
+ minuteText: 'Минути',
+ secondText: 'Секунде',
+ millisecText: 'Милисекунде',
+ microsecText: 'Микросекунде',
+ timezoneText: 'Временска зона',
+ currentText: 'Сада',
+ closeText: 'Затвори',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+ $.timepicker.setDefaults($.timepicker.regional['sr-RS']);
+})(jQuery);
diff --git a/dist/i18n/jquery-ui-timepicker-sr-YU.js b/dist/i18n/jquery-ui-timepicker-sr-YU.js
new file mode 100644
index 0000000..260881a
--- /dev/null
+++ b/dist/i18n/jquery-ui-timepicker-sr-YU.js
@@ -0,0 +1,22 @@
+/* Serbian latin translation for the jQuery Timepicker Addon */
+/* Written by Vladimir Jelovac */
+(function($) {
+ $.timepicker.regional['sr-YU'] = {
+ timeOnlyTitle: 'Odaberite vreme',
+ timeText: 'Vreme',
+ hourText: 'Sati',
+ minuteText: 'Minuti',
+ secondText: 'Sekunde',
+ millisecText: 'Milisekunde',
+ microsecText: 'Mikrosekunde',
+ timezoneText: 'Vremenska zona',
+ currentText: 'Sada',
+ closeText: 'Zatvori',
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+ };
+ $.timepicker.setDefaults($.timepicker.regional['sr-YU']);
+})(jQuery);
diff --git a/localization/jquery-ui-timepicker-sv.js b/dist/i18n/jquery-ui-timepicker-sv.js
similarity index 70%
rename from localization/jquery-ui-timepicker-sv.js
rename to dist/i18n/jquery-ui-timepicker-sv.js
index 167d2f6..7bb0e7e 100644
--- a/localization/jquery-ui-timepicker-sv.js
+++ b/dist/i18n/jquery-ui-timepicker-sv.js
@@ -3,15 +3,17 @@
(function($) {
$.timepicker.regional['sv'] = {
timeOnlyTitle: 'Välj en tid',
- timeText: 'Timme',
- hourText: 'Timmar',
- minuteText: 'Minuter',
- secondText: 'Sekunder',
- millisecText: 'Millisekunder',
+ timeText: 'Tid',
+ hourText: 'Timme',
+ minuteText: 'Minut',
+ secondText: 'Sekund',
+ millisecText: 'Millisekund',
+ microsecText: 'Mikrosekund',
timezoneText: 'Tidszon',
currentText: 'Nu',
closeText: 'Stäng',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-th.js b/dist/i18n/jquery-ui-timepicker-th.js
similarity index 85%
rename from localization/jquery-ui-timepicker-th.js
rename to dist/i18n/jquery-ui-timepicker-th.js
index 5d2d561..4eb93a5 100644
--- a/localization/jquery-ui-timepicker-th.js
+++ b/dist/i18n/jquery-ui-timepicker-th.js
@@ -8,10 +8,12 @@
minuteText: 'นาที',
secondText: 'วินาที',
millisecText: 'มิลลิวินาที',
+ microsecText: 'ไมโคริวินาที',
timezoneText: 'เขตเวลา',
currentText: 'เวลาปัจจุบัน',
closeText: 'ปิด',
- timeFormat: 'hh:mm tt'
+ timeFormat: 'hh:mm tt',
+ timeSuffix: ''
};
$.timepicker.setDefaults($.timepicker.regional['th']);
})(jQuery);
\ No newline at end of file
diff --git a/localization/jquery-ui-timepicker-tr.js b/dist/i18n/jquery-ui-timepicker-tr.js
similarity index 91%
rename from localization/jquery-ui-timepicker-tr.js
rename to dist/i18n/jquery-ui-timepicker-tr.js
index dcbf96d..f426e70 100644
--- a/localization/jquery-ui-timepicker-tr.js
+++ b/dist/i18n/jquery-ui-timepicker-tr.js
@@ -8,10 +8,12 @@
minuteText: 'Dakika',
secondText: 'Saniye',
millisecText: 'Milisaniye',
+ microsecText: 'Mikrosaniye',
timezoneText: 'Zaman Dilimi',
currentText: 'Şu an',
closeText: 'Tamam',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['ÖÖ', 'Ö'],
pmNames: ['ÖS', 'S'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-uk.js b/dist/i18n/jquery-ui-timepicker-uk.js
similarity index 90%
rename from localization/jquery-ui-timepicker-uk.js
rename to dist/i18n/jquery-ui-timepicker-uk.js
index badcbbd..285c8ba 100644
--- a/localization/jquery-ui-timepicker-uk.js
+++ b/dist/i18n/jquery-ui-timepicker-uk.js
@@ -8,10 +8,12 @@
minuteText: 'Хвилини',
secondText: 'Секунди',
millisecText: 'Мілісекунди',
+ microsecText: 'Мікросекунди',
timezoneText: 'Часовий пояс',
currentText: 'Зараз',
closeText: 'Закрити',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-vi.js b/dist/i18n/jquery-ui-timepicker-vi.js
similarity index 74%
rename from localization/jquery-ui-timepicker-vi.js
rename to dist/i18n/jquery-ui-timepicker-vi.js
index 93e6bfc..59fddae 100644
--- a/localization/jquery-ui-timepicker-vi.js
+++ b/dist/i18n/jquery-ui-timepicker-vi.js
@@ -7,13 +7,15 @@
hourText: 'Giờ',
minuteText: 'Phút',
secondText: 'Giây',
- millisecText: 'Phần nghìn giây',
+ millisecText: 'Mili giây',
+ microsecText: 'Micrô giây',
timezoneText: 'Múi giờ',
currentText: 'Hiện thời',
closeText: 'Đóng',
- timeFormat: 'H:m',
- amNames: ['SA', 'AM', 'A'],
- pmNames: ['CH', 'PM', 'P'],
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ amNames: ['SA', 'S'],
+ pmNames: ['CH', 'C'],
isRTL: false
};
$.timepicker.setDefaults($.timepicker.regional['vi']);
diff --git a/localization/jquery-ui-timepicker-zh-CN.js b/dist/i18n/jquery-ui-timepicker-zh-CN.js
similarity index 87%
rename from localization/jquery-ui-timepicker-zh-CN.js
rename to dist/i18n/jquery-ui-timepicker-zh-CN.js
index 16ca718..a5ca804 100644
--- a/localization/jquery-ui-timepicker-zh-CN.js
+++ b/dist/i18n/jquery-ui-timepicker-zh-CN.js
@@ -7,11 +7,13 @@
hourText: '小时',
minuteText: '分钟',
secondText: '秒钟',
- millisecText: '微秒',
+ millisecText: '毫秒',
+ microsecText: '微秒',
timezoneText: '时区',
currentText: '现在时间',
closeText: '关闭',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
isRTL: false
diff --git a/localization/jquery-ui-timepicker-zh-TW.js b/dist/i18n/jquery-ui-timepicker-zh-TW.js
similarity index 92%
rename from localization/jquery-ui-timepicker-zh-TW.js
rename to dist/i18n/jquery-ui-timepicker-zh-TW.js
index ff1ccad..762797b 100644
--- a/localization/jquery-ui-timepicker-zh-TW.js
+++ b/dist/i18n/jquery-ui-timepicker-zh-TW.js
@@ -8,10 +8,12 @@
minuteText: '分',
secondText: '秒',
millisecText: '毫秒',
+ microsecText: '微秒',
timezoneText: '時區',
currentText: '現在時間',
closeText: '確定',
timeFormat: 'HH:mm',
+ timeSuffix: '',
amNames: ['上午', 'AM', 'A'],
pmNames: ['下午', 'PM', 'P'],
isRTL: false
diff --git a/dist/index.html b/dist/index.html
new file mode 100644
index 0000000..8e9f36d
--- /dev/null
+++ b/dist/index.html
@@ -0,0 +1,1105 @@
+
+
+
+
+ Adding a Timepicker to jQuery UI Datepicker
+
+
+
+
+
+
+
+
+
+
+
+
Adding a Timepicker to jQuery UI Datepicker
+
+
The timepicker addon adds a timepicker to jQuery UI Datepicker, thus the datepicker and slider components (jQueryUI) are required for using any of these. In addition all datepicker options are still available through the timepicker addon.
+
+
If you are interested in contributing to Timepicker Addon please check it out on GitHub . If you do make additions please keep in mind I enjoy tabs over spaces,.. But contributions are welcome in any form.
+
+
Back to Blog or Follow on Twitter
+
+
Donation
+
Has this Timepicker Addon been helpful to you?
+
+
+
+
+
+
+
+
+
Getting Started
+
+
Highly Recommended
+
+
Handling Time eBook
+
+
Check out the Handling Time eBook to learn from the basic setup to advanced i18n usage, and from client's javascript to the server's database.
+
+
buy eBook + Example code
+
buy eBook
+
+
+
+
Subscribe to Blog and Twitter
+
Subscribe to my blog via email and follow @PracticalWeb on Twitter. I post for nearly every new version, so you know about updates.
+
+
+
+
Download
+
Download Timepicker Addon and the required CSS .
+
+
Download/Contribute on GitHub (Need the entire repo? Find a bug? See if its fixed here)
+
+
If you prefer a hosted CDN there are a couple available: CDNJS , jsDelivr .
+
+
+
Requirements
+
You also need to include jQuery and jQuery UI with datepicker and slider wigits. You should include them in your page in the following order:
+
+ jQuery
+ jQueryUI (with datepicker and slider wigits)
+ Timepicker
+
+
+
+
Version
+
Version 1.6.3
+
+
Last updated on 2016-04-20
+
jQuery Timepicker Addon is currently available for use in all personal or commercial projects under the MIT license.
+
MIT License
+
+
+
+
+
+
+
Options
+
+
The timepicker does inherit all options from datepicker. However, there are many options that are shared by them both, and many timepicker only options:
+
+
Localization Options
+
+ currentText
+ Default: "Now", A Localization Setting - Text for the Now button.
+
+ closeText
+ Default: "Done", A Localization Setting - Text for the Close button.
+
+ amNames
+ Default: ['AM', 'A'], A Localization Setting - Array of strings to try and parse against to determine AM.
+
+ pmNames
+ Default: ['PM', 'P'], A Localization Setting - Array of strings to try and parse against to determine PM.
+
+ timeFormat
+ Default: "HH:mm", A Localization Setting - String of format tokens to be replaced with the time. See Formatting .
+
+ timeSuffix
+ Default: "", A Localization Setting - String to place after the formatted time.
+
+ timeOnlyTitle
+ Default: "Choose Time", A Localization Setting - Title of the wigit when using only timepicker.
+
+ timeText
+ Default: "Time", A Localization Setting - Label used within timepicker for the formatted time.
+
+ hourText
+ Default: "Hour", A Localization Setting - Label used to identify the hour slider.
+
+ minuteText
+ Default: "Minute", A Localization Setting - Label used to identify the minute slider.
+
+ secondText
+ Default: "Second", A Localization Setting - Label used to identify the second slider.
+
+ millisecText
+ Default: "Millisecond", A Localization Setting - Label used to identify the millisecond slider.
+
+ microsecText
+ Default: "Microsecond", A Localization Setting - Label used to identify the microsecond slider.
+
+ timezoneText
+ Default: "Timezone", A Localization Setting - Label used to identify the timezone slider.
+
+ isRTL
+ Default: false, A Localization Setting - Right to Left support.
+
+
+
Alt Field Options
+
+
+ altFieldTimeOnly
+ Default: true - When altField is used from datepicker altField will only receive the formatted time and the original field only receives date.
+
+ altSeparator
+ Default: (separator option) - String placed between formatted date and formatted time in the altField.
+
+ altTimeSuffix
+ Default: (timeSuffix option) - String always placed after the formatted time in the altField.
+
+ altTimeFormat
+ Default: (timeFormat option) - The time format to use with the altField.
+
+ altRedirectFocus
+ Default: true - Whether to immediately focus the main field whenever the altField receives focus. Effective at construction time only, changing it later has no effect.
+
+
+
Timezone Options
+
+
+ timezoneList
+ Default: [generated timezones] - An array of timezones used to populate the timezone select. Can be an array of values or an array of objects: { label: "EDT", value: -240 }. The value should be the offset number in minutes. So "-0400" which is the format "-hhmm", would equate to -240 minutes.
+
+
+
Time Field Options
+
+
+ controlType
+ Default: 'slider' - Whether to use 'slider' or 'select'. If 'slider' is unavailable through jQueryUI, 'select' will be used. For advanced usage you may pass an object which implements "create", "options", "value" methods to use controls other than sliders or selects. See the _controls property in the source code for more details.
+{
+ create: function(tp_inst, obj, unit, val, min, max, step){
+ // generate whatever controls you want here, just return obj
+ },
+ options: function(tp_inst, obj, unit, opts, val){
+ // if val==undefined return the value, else return obj
+ },
+ value: function(tp_inst, obj, unit, val){
+ // if val==undefined return the value, else return obj
+ }
+}
+
+
+ showHour
+ Default: null - Whether to show the hour control. The default of null will use detection from timeFormat.
+
+ showMinute
+ Default: null - Whether to show the minute control. The default of null will use detection from timeFormat.
+
+ showSecond
+ Default: null - Whether to show the second control. The default of null will use detection from timeFormat.
+
+ showMillisec
+ Default: null - Whether to show the millisecond control. The default of null will use detection from timeFormat.
+
+ showMicrosec
+ Default: null - Whether to show the microsecond control. The default of null will use detection from timeFormat.
+
+ showTimezone
+ Default: null - Whether to show the timezone select.
+
+ showTime
+ Default: true - Whether to show the time selected within the datetimepicker.
+
+ stepHour
+ Default: 1 - Hours per step the slider makes.
+
+ stepMinute
+ Default: 1 - Minutes per step the slider makes.
+
+ stepSecond
+ Default: 1 - Seconds per step the slider makes.
+
+ stepMillisec
+ Default: 1 - Milliseconds per step the slider makes.
+
+ stepMicrosec
+ Default: 1 - Microseconds per step the slider makes.
+
+ hour
+ Default: 0 - Initial hour set.
+
+ minute
+ Default: 0 - Initial minute set.
+
+ second
+ Default: 0 - Initial second set.
+
+ millisec
+ Default: 0 - Initial millisecond set.
+
+ microsec
+ Default: 0 - Initial microsecond set. Note: Javascript's native Date object does not natively support microseconds. Timepicker adds ability to simply Date.setMicroseconds(m) and Date.getMicroseconds(). Date comparisons will not acknowledge microseconds. Use this only for display purposes.
+
+ timezone
+ Default: null - Initial timezone set. This is the offset in minutes. If null the browser's local timezone will be used. If you're timezone is "-0400" you would use -240. For backwards compatibility you may pass "-0400", however the timezone is stored in minutes and more reliable.
+
+ hourMin
+ Default: 0 - The minimum hour allowed for all dates.
+
+ minuteMin
+ Default: 0 - The minimum minute allowed for all dates.
+
+ secondMin
+ Default: 0 - The minimum second allowed for all dates.
+
+ millisecMin
+ Default: 0 - The minimum millisecond allowed for all dates.
+
+ microsecMin
+ Default: 0 - The minimum microsecond allowed for all dates.
+
+ hourMax
+ Default: 23 - The maximum hour allowed for all dates.
+
+ minuteMax
+ Default: 59 - The maximum minute allowed for all dates.
+
+ secondMax
+ Default: 59 - The maximum second allowed for all dates.
+
+ millisecMax
+ Default: 999 - The maximum millisecond allowed for all dates.
+
+ microsecMax
+ Default: 999 - The maximum microsecond allowed for all dates.
+
+ hourGrid
+ Default: 0 - When greater than 0 a label grid will be generated under the slider. This number represents the units (in hours) between labels.
+
+ minuteGrid
+ Default: 0 - When greater than 0 a label grid will be generated under the slider. This number represents the units (in minutes) between labels.
+
+ secondGrid
+ Default: 0 - When greater than 0 a label grid will be genereated under the slider. This number represents the units (in seconds) between labels.
+
+ millisecGrid
+ Default: 0 - When greater than 0 a label grid will be genereated under the slider. This number represents the units (in milliseconds) between labels.
+
+ microsecGrid
+ Default: 0 - When greater than 0 a label grid will be genereated under the slider. This number represents the units (in microseconds) between labels.
+
+
+
Other Options
+
+ showButtonPanel
+ Default: true - Whether to show the button panel at the bottom. This is generally needed.
+
+ timeInput
+ Default: false - Allows direct input in time field
+
+ timeOnly
+ Default: false - Hide the datepicker and only provide a time interface.
+
+ timeOnlyShowDate
+ Default: false - Show the date and time in the input, but only allow the timepicker.
+
+ afterInject
+ Default: null - Function to be called when the timepicker or selection control is injected or re-rendered. Called in the context of the timepicker instance.
+
+ onSelect
+ Default: null - Function to be called when a date is chosen or time has changed (parameters: datetimeText, datepickerInstance).
+
+ alwaysSetTime
+ Default: true - Always have a time set internally, even before user has chosen one.
+
+ separator
+ Default: " " - When formatting the time this string is placed between the formatted date and formatted time.
+
+ pickerTimeFormat
+ Default: (timeFormat option) - How to format the time displayed within the timepicker.
+
+ pickerTimeSuffix
+ Default: (timeSuffix option) - String to place after the formatted time within the timepicker.
+
+ showTimepicker
+ Default: true - Whether to show the timepicker within the datepicker.
+
+ oneLine
+ Default: false - Try to show the time dropdowns all on one line. This should be used with controlType 'select' and as few units as possible.
+
+ addSliderAccess
+ Default: false - Adds the sliderAccess plugin to sliders within timepicker
+
+ sliderAccessArgs
+ Default: null - Object to pass to sliderAccess when used.
+
+ defaultValue
+ Default: null - String of the default time value placed in the input on focus when the input is empty.
+
+ minDateTime
+ Default: null - Date object of the minimum datetime allowed. Also available as minDate.
+
+ maxDateTime
+ Default: null - Date object of the maximum datetime allowed. Also Available as maxDate.
+
+ minTime
+ Default: null - String of the minimum time allowed. '8:00 am' will restrict to times after 8am
+
+ maxTime
+ Default: null - String of the maximum time allowed. '8:00 pm' will restrict to times before 8pm
+
+ parse
+ Default: 'strict' - How to parse the time string. Two methods are provided: 'strict' which must match the timeFormat exactly, and 'loose' which uses javascript's new Date(timeString) to guess the time. You may also pass in a function(timeFormat, timeString, options) to handle the parsing yourself, returning a simple object:
+{
+ hour: 19,
+ minute: 10,
+ second: 23,
+ millisec: 45,
+ microsec: 23,
+ timezone: '-0400'
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Working with Localizations
+
+
Timepicker comes with many translations and localizations, thanks to all the contributors. They can be found in the i18n folder in the git repo.
+
+
The quick and cheap way to use localizations is to pass in options to a timepicker instance:
+
+
$('#example123').timepicker({
+ timeOnlyTitle: 'Выберите время',
+ timeText: 'Время',
+ hourText: 'Часы',
+ minuteText: 'Минуты',
+ secondText: 'Секунды',
+ currentText: 'Сейчас',
+ closeText: 'Закрыть'
+});
+
+
However, if you plan to use timepicker extensively you will need to include (build your own) localization. It is simply assigning those same variables to an object.
+
As you see in the example below we maintain a separate object for timepicker. This way we aren't bound to any future changes within datepicker.
+
+
$.datepicker.regional['ru'] = {
+ closeText: 'Закрыть',
+ prevText: '<Пред',
+ nextText: 'След>',
+ currentText: 'Сегодня',
+ monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь',
+ 'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
+ monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',
+ 'Июл','Авг','Сен','Окт','Ноя','Дек'],
+ dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'],
+ dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
+ dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
+ weekHeader: 'Не',
+ dateFormat: 'dd.mm.yy',
+ firstDay: 1,
+ isRTL: false,
+ showMonthAfterYear: false,
+ yearSuffix: ''
+};
+$.datepicker.setDefaults($.datepicker.regional['ru']);
+
+
+$.timepicker.regional['ru'] = {
+ timeOnlyTitle: 'Выберите время',
+ timeText: 'Время',
+ hourText: 'Часы',
+ minuteText: 'Минуты',
+ secondText: 'Секунды',
+ millisecText: 'Миллисекунды',
+ timezoneText: 'Часовой пояс',
+ currentText: 'Сейчас',
+ closeText: 'Закрыть',
+ timeFormat: 'HH:mm',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ isRTL: false
+};
+$.timepicker.setDefaults($.timepicker.regional['ru']);
+
+
+
Now all you have to do is call timepicker and the Russian localization is used. Generally you only need to include the localization file, it will setDefaults() for you.
+
As of version 1.4.5 a combined file of all localizations available is included. This file DOES NOT call setDefaults(), so you will need to pass, or merge with your options.
+
+
$('#example123').timepicker($.timepicker.regional['ru']);
+
+
+
Localization files for datepicker are typically available in your jQueryUI downloads.
+
+
+
+
+
+
Examples
+
+
+
+
Basic Initializations
+
+
+
+
Add a simple datetimepicker to jQuery UI's datepicker
+
+
+
+
+$('#basic_example_1').datetimepicker();
+
+
+
+
+
+
+
Add only a timepicker:
+
+
+
+
+$('#basic_example_2').timepicker();
+
+
+
+
+
+
Format the time:
+
+
+
+
+$('#basic_example_3').datetimepicker({
+ timeFormat: "hh:mm tt"
+});
+
+
+
+
+
+
+
Timepicker comes with a collection of localization files and one combined file with all available localizations. $.timepicker.regional["your localization code here"] is a simple object with preset options:
+
+
+
+
+$('#basic_example_4').timepicker(
+ $.timepicker.regional['es']
+);
+
+
+
+
Using Timezones
+
+
+
+
Simplest timezone usage:
+
+
+
+
+$('#timezone_example_1').datetimepicker({
+ timeFormat: 'hh:mm tt z'
+});
+
+
+
+
+
+
Define your own timezone options:
+
+
+
+
+$('#timezone_example_2').datetimepicker({
+ timeFormat: 'HH:mm z',
+ timezoneList: [
+ { value: -300, label: 'Eastern'},
+ { value: -360, label: 'Central' },
+ { value: -420, label: 'Mountain' },
+ { value: -480, label: 'Pacific' }
+ ]
+});
+
+
+
+
Slider Modifications
+
+
+
+
Add a grid to each slider:
+
+
+
+
+$('#slider_example_1').timepicker({
+ hourGrid: 4,
+ minuteGrid: 10,
+ timeFormat: 'hh:mm tt'
+});
+
+
+
+
+
+
Set the interval step of sliders:
+
+
+
+
+$('#slider_example_2').datetimepicker({
+ timeFormat: 'HH:mm:ss',
+ stepHour: 2,
+ stepMinute: 10,
+ stepSecond: 10
+});
+
+
+
+
+
+
Add sliderAccess plugin for touch devices:
+
+
+
+
+$('#slider_example_3').datetimepicker({
+ addSliderAccess: true,
+ sliderAccessArgs: { touchonly: false }
+});
+
+
+
+
+
Use dropdowns instead of sliders. By default if slider is not available dropdowns will be used.
+
+
+
+
+$('#slider_example_4').datetimepicker({
+ controlType: 'select',
+ timeFormat: 'hh:mm tt'
+});
+
+
+
+
+
Uses one line dropdowns instead of sliders.
+
+
+
+
+$('#slider_example_4andHalf').datetimepicker({
+ controlType: 'select',
+ oneLine: true,
+ timeFormat: 'hh:mm tt'
+});
+
+
+
+
+
Create your own control by implementing the create, options, and value methods. If you want to use your new control for all instances use the $.timepicker.setDefaults({controlType:myControl}). Here we implement jQueryUI's spinner control (jQueryUI 1.9+).
+
+
+
+
var myControl= {
+ create: function(tp_inst, obj, unit, val, min, max, step){
+ $('<input class="ui-timepicker-input" value="'+val+'" style="width:50%">')
+ .appendTo(obj)
+ .spinner({
+ min: min,
+ max: max,
+ step: step,
+ change: function(e,ui){ // key events
+ // don't call if api was used and not key press
+ if(e.originalEvent !== undefined)
+ tp_inst._onTimeChange();
+ tp_inst._onSelectHandler();
+ },
+ spin: function(e,ui){ // spin events
+ tp_inst.control.value(tp_inst, obj, unit, ui.value);
+ tp_inst._onTimeChange();
+ tp_inst._onSelectHandler();
+ }
+ });
+ return obj;
+ },
+ options: function(tp_inst, obj, unit, opts, val){
+ if(typeof(opts) == 'string' && val !== undefined)
+ return obj.find('.ui-timepicker-input').spinner(opts, val);
+ return obj.find('.ui-timepicker-input').spinner(opts);
+ },
+ value: function(tp_inst, obj, unit, val){
+ if(val !== undefined)
+ return obj.find('.ui-timepicker-input').spinner('value', val);
+ return obj.find('.ui-timepicker-input').spinner('value');
+ }
+};
+
+$('#slider_example_5').datetimepicker({
+ controlType: myControl
+});
+
+
+
Alternate Fields
+
+
+
+
Alt field in the simplest form:
+
+
+
+
+
+$('#alt_example_1').datetimepicker({
+ altField: "#alt_example_1_alt"
+});
+
+
+
+
+
+
With datetime in both:
+
+
+
+
+
+$('#alt_example_2').datetimepicker({
+ altField: "#alt_example_2_alt",
+ altFieldTimeOnly: false
+});
+
+
+
+
+
+
Format the altField differently:
+
+
+
+
+
+$('#alt_example_3').datetimepicker({
+ altField: "#alt_example_3_alt",
+ altFieldTimeOnly: false,
+ altFormat: "yy-mm-dd",
+ altTimeFormat: "h:m t",
+ altSeparator: " @ "
+});
+
+
+
+
+
+
With inline mode using altField:
+
+
+
+
+
+$('#alt_example_4').datetimepicker({
+ altField: "#alt_example_4_alt",
+ altFieldTimeOnly: false
+});
+
+
+
+
+
+
+
+
Allows time displayed inside the picker to allow being typed in.
+
+
+
+
+$('#input_example_1').datetimepicker({
+ timeInput: true,
+ timeFormat: "hh:mm tt"
+});
+
+
+
+
+
+
Don't show any sliders, only the time input.
+
+
+
+
+$('#input_example_2').datetimepicker({
+ timeInput: true,
+ timeFormat: "hh:mm tt",
+ showHour: false,
+ showMinute: false
+});
+
+
+
+
Time Restraints
+
+
+
+
Set the min/max hour of every date:
+
+
+
+
+$('#rest_example_1').timepicker({
+ hourMin: 8,
+ hourMax: 16
+});
+
+
+
+
+
+
Set the min/max date numerically:
+
+
+
+
+$('#rest_example_2').datetimepicker({
+ numberOfMonths: 2,
+ minDate: 0,
+ maxDate: 30
+});
+
+
+
+
+
+
Set the min/max date and time with a Date object:
+
+
+
+
+$('#rest_example_3').datetimepicker({
+ minDate: new Date(2010, 11, 20, 8, 30),
+ maxDate: new Date(2010, 11, 31, 17, 30)
+});
+
+
+
+
+
Time Ranges
+
+
+
+
Restrict a start and end date by using onSelect and onClose events for more control over functionality:
+
For more examples and advanced usage grab the Handling Time eBook .
+
+
+
+
+
+var startDateTextBox = $('#range_example_1_start');
+var endDateTextBox = $('#range_example_1_end');
+
+startDateTextBox.datetimepicker({
+ timeFormat: 'HH:mm z',
+ onClose: function(dateText, inst) {
+ if (endDateTextBox.val() != '') {
+ var testStartDate = startDateTextBox.datetimepicker('getDate');
+ var testEndDate = endDateTextBox.datetimepicker('getDate');
+ if (testStartDate > testEndDate)
+ endDateTextBox.datetimepicker('setDate', testStartDate);
+ }
+ else {
+ endDateTextBox.val(dateText);
+ }
+ },
+ onSelect: function (selectedDateTime){
+ endDateTextBox.datetimepicker('option', 'minDate', startDateTextBox.datetimepicker('getDate') );
+ }
+});
+endDateTextBox.datetimepicker({
+ timeFormat: 'HH:mm z',
+ onClose: function(dateText, inst) {
+ if (startDateTextBox.val() != '') {
+ var testStartDate = startDateTextBox.datetimepicker('getDate');
+ var testEndDate = endDateTextBox.datetimepicker('getDate');
+ if (testStartDate > testEndDate)
+ startDateTextBox.datetimepicker('setDate', testEndDate);
+ }
+ else {
+ startDateTextBox.val(dateText);
+ }
+ },
+ onSelect: function (selectedDateTime){
+ startDateTextBox.datetimepicker('option', 'maxDate', endDateTextBox.datetimepicker('getDate') );
+ }
+});
+
+
+
+
+
+
Timepicker also includes some shortcut methods for ranges:
+
+
+
+
+
+var startDateTextBox = $('#range_example_2_start');
+var endDateTextBox = $('#range_example_2_end');
+
+$.timepicker.datetimeRange(
+ startDateTextBox,
+ endDateTextBox,
+ {
+ minInterval: (1000*60*60), // 1hr
+ dateFormat: 'dd M yy',
+ timeFormat: 'HH:mm',
+ start: {}, // start picker options
+ end: {} // end picker options
+ }
+);
+
+
+
+
+
+
To use only times for a time range use $.timepicker.timeRange():
+
+
+
+
+
+var startTimeTextBox = $('#range_example_3_start');
+var endTimeTextBox = $('#range_example_3_end');
+
+$.timepicker.timeRange(
+ startTimeTextBox,
+ endTimeTextBox,
+ {
+ minInterval: (1000*60*60), // 1hr
+ timeFormat: 'HH:mm',
+ start: {}, // start picker options
+ end: {} // end picker options
+ }
+);
+
+
+
+
+
+
Even though this plugin focuses on datetime, it also provides a dateRange function:
+
+
+
+
+
+var startDateTextBox = $('#range_example_4_start');
+var endDateTextBox = $('#range_example_4_end');
+
+$.timepicker.dateRange(
+ startDateTextBox,
+ endDateTextBox,
+ {
+ minInterval: (1000*60*60*24*4), // 4 days
+ maxInterval: (1000*60*60*24*8), // 8 days
+ start: {}, // start picker options
+ end: {} // end picker options
+ }
+);
+
+
+
+
Utilities
+
+
+
+
Get and Set Datetime with the getDate and setDate methods. This example uses timezone to demonstrate the timepicker regonizes the timezones and computes the offsets when getting and setting.
+
+
+ Set Datetime
+ Get Datetime
+
+
+
+var ex13 = $('#utility_example_1');
+
+ex13.datetimepicker({
+ timeFormat: 'hh:mm tt z',
+ separator: ' @ ',
+ showTimezone: true
+});
+
+$('#utility_example_1_setdt').click(function(){
+ ex13.datetimepicker('setDate', (new Date()) );
+});
+
+$('#utility_example_1_getdt').click(function(){
+ alert(ex13.datetimepicker('getDate'));
+});
+
+
+
+
+
+
Use the utility function to format your own time. $.datepicker.formatTime(format, time, options)
+
+ format required - string represenation of the time format to use
+ time required - hash: { hour, minute, second, millisecond, timezone }
+ options optional - hash of any options in regional translation (ampm, amNames, pmNames..)
+
+
Returns a time string in the specified format.
+
+
+
+$('#utility_example_2').text(
+ $.datepicker.formatTime('HH:mm z', { hour: 14, minute: 36, timezone: '+2000' }, {})
+);
+
+
+
+
+
+
Use the utility function to parses a formatted time. $.datepicker.parseTime(format, timeString, options)
+
+ format required - string represenation of the time format to use
+ time required - time string matching the format given in parameter 1
+ options optional - hash of any options in regional translation (ampm, amNames, pmNames..)
+
+
Returns an object with hours, minutes, seconds, milliseconds, timezone.
+
+
+
+$('#utility_example_3').text(JSON.stringify(
+ $.datepicker.parseTime('HH:mm:ss:l z', "14:36:21:765 +2000", {})
+));
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jquery-ui-sliderAccess.js b/dist/jquery-ui-sliderAccess.js
similarity index 91%
rename from jquery-ui-sliderAccess.js
rename to dist/jquery-ui-sliderAccess.js
index a54cf4a..b075c66 100644
--- a/jquery-ui-sliderAccess.js
+++ b/dist/jquery-ui-sliderAccess.js
@@ -17,8 +17,9 @@
options = options || {};
options.touchonly = options.touchonly !== undefined? options.touchonly : true; // by default only show it if touch device
- if(options.touchonly === true && !("ontouchend" in document))
+ if(options.touchonly === true && !("ontouchend" in document)){
return $(this);
+ }
return $(this).each(function(i,obj){
var $t = $(this),
@@ -56,8 +57,9 @@
e.preventDefault();
- if(newval < minval || newval > maxval)
+ if(newval < minval || newval > maxval){
return;
+ }
$t.slider('value', newval);
@@ -77,8 +79,8 @@
// adjust the width so we don't break the original layout
var bOuterWidth = $buttons.css({
- marginLeft: ((o.where == 'after' && !o.isRTL) || (o.where == 'before' && o.isRTL)? 10:0),
- marginRight: ((o.where == 'before' && !o.isRTL) || (o.where == 'after' && o.isRTL)? 10:0)
+ marginLeft: ((o.where === 'after' && !o.isRTL) || (o.where === 'before' && o.isRTL)? 10:0),
+ marginRight: ((o.where === 'before' && !o.isRTL) || (o.where === 'after' && o.isRTL)? 10:0)
}).outerWidth(true) + 5;
var tOuterWidth = $t.outerWidth(true);
$t.css('display','inline-block').width(tOuterWidth-bOuterWidth);
diff --git a/dist/jquery-ui-timepicker-addon.css b/dist/jquery-ui-timepicker-addon.css
new file mode 100644
index 0000000..586a7f0
--- /dev/null
+++ b/dist/jquery-ui-timepicker-addon.css
@@ -0,0 +1,30 @@
+.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
+.ui-timepicker-div dl { text-align: left; }
+.ui-timepicker-div dl dt { float: left; clear:left; padding: 0 0 0 5px; }
+.ui-timepicker-div dl dd { margin: 0 10px 10px 40%; }
+.ui-timepicker-div td { font-size: 90%; }
+.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
+.ui-timepicker-div .ui_tpicker_unit_hide{ display: none; }
+
+.ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input { background: none; color: inherit; border: none; outline: none; border-bottom: solid 1px #555; width: 95%; }
+.ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input:focus { border-bottom-color: #aaa; }
+
+.ui-timepicker-rtl{ direction: rtl; }
+.ui-timepicker-rtl dl { text-align: right; padding: 0 5px 0 0; }
+.ui-timepicker-rtl dl dt{ float: right; clear: right; }
+.ui-timepicker-rtl dl dd { margin: 0 40% 10px 10px; }
+
+/* Shortened version style */
+.ui-timepicker-div.ui-timepicker-oneLine { padding-right: 2px; }
+.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time,
+.ui-timepicker-div.ui-timepicker-oneLine dt { display: none; }
+.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time_label { display: block; padding-top: 2px; }
+.ui-timepicker-div.ui-timepicker-oneLine dl { text-align: right; }
+.ui-timepicker-div.ui-timepicker-oneLine dl dd,
+.ui-timepicker-div.ui-timepicker-oneLine dl dd > div { display:inline-block; margin:0; }
+.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_minute:before,
+.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_second:before { content:':'; display:inline-block; }
+.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_millisec:before,
+.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_microsec:before { content:'.'; display:inline-block; }
+.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide,
+.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide:before{ display: none; }
\ No newline at end of file
diff --git a/dist/jquery-ui-timepicker-addon.js b/dist/jquery-ui-timepicker-addon.js
new file mode 100644
index 0000000..d37bc02
--- /dev/null
+++ b/dist/jquery-ui-timepicker-addon.js
@@ -0,0 +1,2291 @@
+/*! jQuery Timepicker Addon - v1.6.3 - 2016-04-20
+* http://trentrichardson.com/examples/timepicker
+* Copyright (c) 2016 Trent Richardson; Licensed MIT */
+(function (factory) {
+ if (typeof define === 'function' && define.amd) {
+ define(['jquery', 'jquery-ui'], factory);
+ } else {
+ factory(jQuery);
+ }
+}(function ($) {
+
+ /*
+ * Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded"
+ */
+ $.ui.timepicker = $.ui.timepicker || {};
+ if ($.ui.timepicker.version) {
+ return;
+ }
+
+ /*
+ * Extend jQueryUI, get it started with our version number
+ */
+ $.extend($.ui, {
+ timepicker: {
+ version: "1.6.3"
+ }
+ });
+
+ /*
+ * Timepicker manager.
+ * Use the singleton instance of this class, $.timepicker, to interact with the time picker.
+ * Settings for (groups of) time pickers are maintained in an instance object,
+ * allowing multiple different settings on the same page.
+ */
+ var Timepicker = function () {
+ this.regional = []; // Available regional settings, indexed by language code
+ this.regional[''] = { // Default regional settings
+ currentText: 'Now',
+ closeText: 'Done',
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ timeFormat: 'HH:mm',
+ timeSuffix: '',
+ timeOnlyTitle: 'Choose Time',
+ timeText: 'Time',
+ hourText: 'Hour',
+ minuteText: 'Minute',
+ secondText: 'Second',
+ millisecText: 'Millisecond',
+ microsecText: 'Microsecond',
+ timezoneText: 'Time Zone',
+ isRTL: false
+ };
+ this._defaults = { // Global defaults for all the datetime picker instances
+ showButtonPanel: true,
+ timeOnly: false,
+ timeOnlyShowDate: false,
+ showHour: null,
+ showMinute: null,
+ showSecond: null,
+ showMillisec: null,
+ showMicrosec: null,
+ showTimezone: null,
+ showTime: true,
+ stepHour: 1,
+ stepMinute: 1,
+ stepSecond: 1,
+ stepMillisec: 1,
+ stepMicrosec: 1,
+ hour: 0,
+ minute: 0,
+ second: 0,
+ millisec: 0,
+ microsec: 0,
+ timezone: null,
+ hourMin: 0,
+ minuteMin: 0,
+ secondMin: 0,
+ millisecMin: 0,
+ microsecMin: 0,
+ hourMax: 23,
+ minuteMax: 59,
+ secondMax: 59,
+ millisecMax: 999,
+ microsecMax: 999,
+ minDateTime: null,
+ maxDateTime: null,
+ maxTime: null,
+ minTime: null,
+ onSelect: null,
+ hourGrid: 0,
+ minuteGrid: 0,
+ secondGrid: 0,
+ millisecGrid: 0,
+ microsecGrid: 0,
+ alwaysSetTime: true,
+ separator: ' ',
+ altFieldTimeOnly: true,
+ altTimeFormat: null,
+ altSeparator: null,
+ altTimeSuffix: null,
+ altRedirectFocus: true,
+ pickerTimeFormat: null,
+ pickerTimeSuffix: null,
+ showTimepicker: true,
+ timezoneList: null,
+ addSliderAccess: false,
+ sliderAccessArgs: null,
+ controlType: 'slider',
+ oneLine: false,
+ defaultValue: null,
+ parse: 'strict',
+ afterInject: null
+ };
+ $.extend(this._defaults, this.regional['']);
+ };
+
+ $.extend(Timepicker.prototype, {
+ $input: null,
+ $altInput: null,
+ $timeObj: null,
+ inst: null,
+ hour_slider: null,
+ minute_slider: null,
+ second_slider: null,
+ millisec_slider: null,
+ microsec_slider: null,
+ timezone_select: null,
+ maxTime: null,
+ minTime: null,
+ hour: 0,
+ minute: 0,
+ second: 0,
+ millisec: 0,
+ microsec: 0,
+ timezone: null,
+ hourMinOriginal: null,
+ minuteMinOriginal: null,
+ secondMinOriginal: null,
+ millisecMinOriginal: null,
+ microsecMinOriginal: null,
+ hourMaxOriginal: null,
+ minuteMaxOriginal: null,
+ secondMaxOriginal: null,
+ millisecMaxOriginal: null,
+ microsecMaxOriginal: null,
+ ampm: '',
+ formattedDate: '',
+ formattedTime: '',
+ formattedDateTime: '',
+ timezoneList: null,
+ units: ['hour', 'minute', 'second', 'millisec', 'microsec'],
+ support: {},
+ control: null,
+
+ /*
+ * Override the default settings for all instances of the time picker.
+ * @param {Object} settings object - the new settings to use as defaults (anonymous object)
+ * @return {Object} the manager object
+ */
+ setDefaults: function (settings) {
+ extendRemove(this._defaults, settings || {});
+ return this;
+ },
+
+ /*
+ * Create a new Timepicker instance
+ */
+ _newInst: function ($input, opts) {
+ var tp_inst = new Timepicker(),
+ inlineSettings = {},
+ fns = {},
+ overrides, i;
+
+ for (var attrName in this._defaults) {
+ if (this._defaults.hasOwnProperty(attrName)) {
+ var attrValue = $input.attr('time:' + attrName);
+ if (attrValue) {
+ try {
+ inlineSettings[attrName] = eval(attrValue);
+ } catch (err) {
+ inlineSettings[attrName] = attrValue;
+ }
+ }
+ }
+ }
+
+ overrides = {
+ beforeShow: function (input, dp_inst) {
+ if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) {
+ return tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst);
+ }
+ },
+ onChangeMonthYear: function (year, month, dp_inst) {
+ // Update the time as well : this prevents the time from disappearing from the $input field.
+ // tp_inst._updateDateTime(dp_inst);
+ if ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) {
+ tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
+ }
+ },
+ onClose: function (dateText, dp_inst) {
+ if (tp_inst.timeDefined === true && $input.val() !== '') {
+ tp_inst._updateDateTime(dp_inst);
+ }
+ if ($.isFunction(tp_inst._defaults.evnts.onClose)) {
+ tp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst);
+ }
+ }
+ };
+ for (i in overrides) {
+ if (overrides.hasOwnProperty(i)) {
+ fns[i] = opts[i] || this._defaults[i] || null;
+ }
+ }
+
+ tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, opts, overrides, {
+ evnts: fns,
+ timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
+ });
+ tp_inst.amNames = $.map(tp_inst._defaults.amNames, function (val) {
+ return val.toUpperCase();
+ });
+ tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function (val) {
+ return val.toUpperCase();
+ });
+
+ // detect which units are supported
+ tp_inst.support = detectSupport(
+ tp_inst._defaults.timeFormat +
+ (tp_inst._defaults.pickerTimeFormat ? tp_inst._defaults.pickerTimeFormat : '') +
+ (tp_inst._defaults.altTimeFormat ? tp_inst._defaults.altTimeFormat : ''));
+
+ // controlType is string - key to our this._controls
+ if (typeof(tp_inst._defaults.controlType) === 'string') {
+ if (tp_inst._defaults.controlType === 'slider' && typeof($.ui.slider) === 'undefined') {
+ tp_inst._defaults.controlType = 'select';
+ }
+ tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];
+ }
+ // controlType is an object and must implement create, options, value methods
+ else {
+ tp_inst.control = tp_inst._defaults.controlType;
+ }
+
+ // prep the timezone options
+ var timezoneList = [-720, -660, -600, -570, -540, -480, -420, -360, -300, -270, -240, -210, -180, -120, -60,
+ 0, 60, 120, 180, 210, 240, 270, 300, 330, 345, 360, 390, 420, 480, 525, 540, 570, 600, 630, 660, 690, 720, 765, 780, 840];
+ if (tp_inst._defaults.timezoneList !== null) {
+ timezoneList = tp_inst._defaults.timezoneList;
+ }
+ var tzl = timezoneList.length, tzi = 0, tzv = null;
+ if (tzl > 0 && typeof timezoneList[0] !== 'object') {
+ for (; tzi < tzl; tzi++) {
+ tzv = timezoneList[tzi];
+ timezoneList[tzi] = { value: tzv, label: $.timepicker.timezoneOffsetString(tzv, tp_inst.support.iso8601) };
+ }
+ }
+ tp_inst._defaults.timezoneList = timezoneList;
+
+ // set the default units
+ tp_inst.timezone = tp_inst._defaults.timezone !== null ? $.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone) :
+ ((new Date()).getTimezoneOffset() * -1);
+ tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin ? tp_inst._defaults.hourMin :
+ tp_inst._defaults.hour > tp_inst._defaults.hourMax ? tp_inst._defaults.hourMax : tp_inst._defaults.hour;
+ tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin ? tp_inst._defaults.minuteMin :
+ tp_inst._defaults.minute > tp_inst._defaults.minuteMax ? tp_inst._defaults.minuteMax : tp_inst._defaults.minute;
+ tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin ? tp_inst._defaults.secondMin :
+ tp_inst._defaults.second > tp_inst._defaults.secondMax ? tp_inst._defaults.secondMax : tp_inst._defaults.second;
+ tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin ? tp_inst._defaults.millisecMin :
+ tp_inst._defaults.millisec > tp_inst._defaults.millisecMax ? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec;
+ tp_inst.microsec = tp_inst._defaults.microsec < tp_inst._defaults.microsecMin ? tp_inst._defaults.microsecMin :
+ tp_inst._defaults.microsec > tp_inst._defaults.microsecMax ? tp_inst._defaults.microsecMax : tp_inst._defaults.microsec;
+ tp_inst.ampm = '';
+ tp_inst.$input = $input;
+
+ if (tp_inst._defaults.altField) {
+ tp_inst.$altInput = $(tp_inst._defaults.altField);
+ if (tp_inst._defaults.altRedirectFocus === true) {
+ tp_inst.$altInput.css({
+ cursor: 'pointer'
+ }).focus(function () {
+ $input.trigger("focus");
+ });
+ }
+ }
+
+ if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) {
+ tp_inst._defaults.minDate = new Date();
+ }
+ if (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) {
+ tp_inst._defaults.maxDate = new Date();
+ }
+
+ // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
+ if (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) {
+ tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
+ }
+ if (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) {
+ tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
+ }
+ if (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) {
+ tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
+ }
+ if (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) {
+ tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
+ }
+ tp_inst.$input.bind('focus', function () {
+ tp_inst._onFocus();
+ });
+
+ return tp_inst;
+ },
+
+ /*
+ * add our sliders to the calendar
+ */
+ _addTimePicker: function (dp_inst) {
+ var currDT = $.trim((this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val());
+
+ this.timeDefined = this._parseTime(currDT);
+ this._limitMinMaxDateTime(dp_inst, false);
+ this._injectTimePicker();
+ this._afterInject();
+ },
+
+ /*
+ * parse the time string from input value or _setTime
+ */
+ _parseTime: function (timeString, withDate) {
+ if (!this.inst) {
+ this.inst = $.datepicker._getInst(this.$input[0]);
+ }
+
+ if (withDate || !this._defaults.timeOnly) {
+ var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
+ try {
+ var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults);
+ if (!parseRes.timeObj) {
+ return false;
+ }
+ $.extend(this, parseRes.timeObj);
+ } catch (err) {
+ $.timepicker.log("Error parsing the date/time string: " + err +
+ "\ndate/time string = " + timeString +
+ "\ntimeFormat = " + this._defaults.timeFormat +
+ "\ndateFormat = " + dp_dateFormat);
+ return false;
+ }
+ return true;
+ } else {
+ var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults);
+ if (!timeObj) {
+ return false;
+ }
+ $.extend(this, timeObj);
+ return true;
+ }
+ },
+
+ /*
+ * Handle callback option after injecting timepicker
+ */
+ _afterInject: function() {
+ var o = this.inst.settings;
+ if ($.isFunction(o.afterInject)) {
+ o.afterInject.call(this);
+ }
+ },
+
+ /*
+ * generate and inject html for timepicker into ui datepicker
+ */
+ _injectTimePicker: function () {
+ var $dp = this.inst.dpDiv,
+ o = this.inst.settings,
+ tp_inst = this,
+ litem = '',
+ uitem = '',
+ show = null,
+ max = {},
+ gridSize = {},
+ size = null,
+ i = 0,
+ l = 0;
+
+ // Prevent displaying twice
+ if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
+ var noDisplay = ' ui_tpicker_unit_hide',
+ html = '
';
+ var $tp = $(html);
+
+ // if we only want time picker...
+ if (o.timeOnly === true) {
+ $tp.prepend('');
+ $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
+ }
+
+ // add sliders, adjust grids, add events
+ for (i = 0, l = tp_inst.units.length; i < l; i++) {
+ litem = tp_inst.units[i];
+ uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1);
+ show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem];
+
+ // add the slider
+ tp_inst[litem + '_slider'] = tp_inst.control.create(tp_inst, $tp.find('.ui_tpicker_' + litem + '_slider'), litem, tp_inst[litem], o[litem + 'Min'], max[litem], o['step' + uitem]);
+
+ // adjust the grid and add click event
+ if (show && o[litem + 'Grid'] > 0) {
+ size = 100 * gridSize[litem] * o[litem + 'Grid'] / (max[litem] - o[litem + 'Min']);
+ $tp.find('.ui_tpicker_' + litem + ' table').css({
+ width: size + "%",
+ marginLeft: o.isRTL ? '0' : ((size / (-2 * gridSize[litem])) + "%"),
+ marginRight: o.isRTL ? ((size / (-2 * gridSize[litem])) + "%") : '0',
+ borderCollapse: 'collapse'
+ }).find("td").click(function (e) {
+ var $t = $(this),
+ h = $t.html(),
+ n = parseInt(h.replace(/[^0-9]/g), 10),
+ ap = h.replace(/[^apm]/ig),
+ f = $t.data('for'); // loses scope, so we use data-for
+
+ if (f === 'hour') {
+ if (ap.indexOf('p') !== -1 && n < 12) {
+ n += 12;
+ }
+ else {
+ if (ap.indexOf('a') !== -1 && n === 12) {
+ n = 0;
+ }
+ }
+ }
+
+ tp_inst.control.value(tp_inst, tp_inst[f + '_slider'], litem, n);
+
+ tp_inst._onTimeChange();
+ tp_inst._onSelectHandler();
+ }).css({
+ cursor: 'pointer',
+ width: (100 / gridSize[litem]) + '%',
+ textAlign: 'center',
+ overflow: 'hidden'
+ });
+ } // end if grid > 0
+ } // end for loop
+
+ // Add timezone options
+ this.timezone_select = $tp.find('.ui_tpicker_timezone').append('
').find("select");
+ $.fn.append.apply(this.timezone_select,
+ $.map(o.timezoneList, function (val, idx) {
+ return $("
").val(typeof val === "object" ? val.value : val).text(typeof val === "object" ? val.label : val);
+ }));
+ if (typeof(this.timezone) !== "undefined" && this.timezone !== null && this.timezone !== "") {
+ var local_timezone = (new Date(this.inst.selectedYear, this.inst.selectedMonth, this.inst.selectedDay, 12)).getTimezoneOffset() * -1;
+ if (local_timezone === this.timezone) {
+ selectLocalTimezone(tp_inst);
+ } else {
+ this.timezone_select.val(this.timezone);
+ }
+ } else {
+ if (typeof(this.hour) !== "undefined" && this.hour !== null && this.hour !== "") {
+ this.timezone_select.val(o.timezone);
+ } else {
+ selectLocalTimezone(tp_inst);
+ }
+ }
+ this.timezone_select.change(function () {
+ tp_inst._onTimeChange();
+ tp_inst._onSelectHandler();
+ tp_inst._afterInject();
+ });
+ // End timezone options
+
+ // inject timepicker into datepicker
+ var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
+ if ($buttonPanel.length) {
+ $buttonPanel.before($tp);
+ } else {
+ $dp.append($tp);
+ }
+
+ this.$timeObj = $tp.find('.ui_tpicker_time_input');
+ this.$timeObj.change(function () {
+ var timeFormat = tp_inst.inst.settings.timeFormat;
+ var parsedTime = $.datepicker.parseTime(timeFormat, this.value);
+ var update = new Date();
+ if (parsedTime) {
+ update.setHours(parsedTime.hour);
+ update.setMinutes(parsedTime.minute);
+ update.setSeconds(parsedTime.second);
+ $.datepicker._setTime(tp_inst.inst, update);
+ } else {
+ this.value = tp_inst.formattedTime;
+ this.blur();
+ }
+ });
+
+ if (this.inst !== null) {
+ var timeDefined = this.timeDefined;
+ this._onTimeChange();
+ this.timeDefined = timeDefined;
+ }
+
+ // slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
+ if (this._defaults.addSliderAccess) {
+ var sliderAccessArgs = this._defaults.sliderAccessArgs,
+ rtl = this._defaults.isRTL;
+ sliderAccessArgs.isRTL = rtl;
+
+ setTimeout(function () { // fix for inline mode
+ if ($tp.find('.ui-slider-access').length === 0) {
+ $tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
+
+ // fix any grids since sliders are shorter
+ var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
+ if (sliderAccessWidth) {
+ $tp.find('table:visible').each(function () {
+ var $g = $(this),
+ oldWidth = $g.outerWidth(),
+ oldMarginLeft = $g.css(rtl ? 'marginRight' : 'marginLeft').toString().replace('%', ''),
+ newWidth = oldWidth - sliderAccessWidth,
+ newMarginLeft = ((oldMarginLeft * newWidth) / oldWidth) + '%',
+ css = { width: newWidth, marginRight: 0, marginLeft: 0 };
+ css[rtl ? 'marginRight' : 'marginLeft'] = newMarginLeft;
+ $g.css(css);
+ });
+ }
+ }
+ }, 10);
+ }
+ // end slideAccess integration
+
+ tp_inst._limitMinMaxDateTime(this.inst, true);
+ }
+ },
+
+ /*
+ * This function tries to limit the ability to go outside the
+ * min/max date range
+ */
+ _limitMinMaxDateTime: function (dp_inst, adjustSliders) {
+ var o = this._defaults,
+ dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);
+
+ if (!this._defaults.showTimepicker) {
+ return;
+ } // No time so nothing to check here
+
+ if ($.datepicker._get(dp_inst, 'minDateTime') !== null && $.datepicker._get(dp_inst, 'minDateTime') !== undefined && dp_date) {
+ var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
+ minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
+
+ if (this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null || this.microsecMinOriginal === null) {
+ this.hourMinOriginal = o.hourMin;
+ this.minuteMinOriginal = o.minuteMin;
+ this.secondMinOriginal = o.secondMin;
+ this.millisecMinOriginal = o.millisecMin;
+ this.microsecMinOriginal = o.microsecMin;
+ }
+
+ if (dp_inst.settings.timeOnly || minDateTimeDate.getTime() === dp_date.getTime()) {
+ this._defaults.hourMin = minDateTime.getHours();
+ if (this.hour <= this._defaults.hourMin) {
+ this.hour = this._defaults.hourMin;
+ this._defaults.minuteMin = minDateTime.getMinutes();
+ if (this.minute <= this._defaults.minuteMin) {
+ this.minute = this._defaults.minuteMin;
+ this._defaults.secondMin = minDateTime.getSeconds();
+ if (this.second <= this._defaults.secondMin) {
+ this.second = this._defaults.secondMin;
+ this._defaults.millisecMin = minDateTime.getMilliseconds();
+ if (this.millisec <= this._defaults.millisecMin) {
+ this.millisec = this._defaults.millisecMin;
+ this._defaults.microsecMin = minDateTime.getMicroseconds();
+ } else {
+ if (this.microsec < this._defaults.microsecMin) {
+ this.microsec = this._defaults.microsecMin;
+ }
+ this._defaults.microsecMin = this.microsecMinOriginal;
+ }
+ } else {
+ this._defaults.millisecMin = this.millisecMinOriginal;
+ this._defaults.microsecMin = this.microsecMinOriginal;
+ }
+ } else {
+ this._defaults.secondMin = this.secondMinOriginal;
+ this._defaults.millisecMin = this.millisecMinOriginal;
+ this._defaults.microsecMin = this.microsecMinOriginal;
+ }
+ } else {
+ this._defaults.minuteMin = this.minuteMinOriginal;
+ this._defaults.secondMin = this.secondMinOriginal;
+ this._defaults.millisecMin = this.millisecMinOriginal;
+ this._defaults.microsecMin = this.microsecMinOriginal;
+ }
+ } else {
+ this._defaults.hourMin = this.hourMinOriginal;
+ this._defaults.minuteMin = this.minuteMinOriginal;
+ this._defaults.secondMin = this.secondMinOriginal;
+ this._defaults.millisecMin = this.millisecMinOriginal;
+ this._defaults.microsecMin = this.microsecMinOriginal;
+ }
+ }
+
+ if ($.datepicker._get(dp_inst, 'maxDateTime') !== null && $.datepicker._get(dp_inst, 'maxDateTime') !== undefined && dp_date) {
+ var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
+ maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
+
+ if (this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null || this.millisecMaxOriginal === null) {
+ this.hourMaxOriginal = o.hourMax;
+ this.minuteMaxOriginal = o.minuteMax;
+ this.secondMaxOriginal = o.secondMax;
+ this.millisecMaxOriginal = o.millisecMax;
+ this.microsecMaxOriginal = o.microsecMax;
+ }
+
+ if (dp_inst.settings.timeOnly || maxDateTimeDate.getTime() === dp_date.getTime()) {
+ this._defaults.hourMax = maxDateTime.getHours();
+ if (this.hour >= this._defaults.hourMax) {
+ this.hour = this._defaults.hourMax;
+ this._defaults.minuteMax = maxDateTime.getMinutes();
+ if (this.minute >= this._defaults.minuteMax) {
+ this.minute = this._defaults.minuteMax;
+ this._defaults.secondMax = maxDateTime.getSeconds();
+ if (this.second >= this._defaults.secondMax) {
+ this.second = this._defaults.secondMax;
+ this._defaults.millisecMax = maxDateTime.getMilliseconds();
+ if (this.millisec >= this._defaults.millisecMax) {
+ this.millisec = this._defaults.millisecMax;
+ this._defaults.microsecMax = maxDateTime.getMicroseconds();
+ } else {
+ if (this.microsec > this._defaults.microsecMax) {
+ this.microsec = this._defaults.microsecMax;
+ }
+ this._defaults.microsecMax = this.microsecMaxOriginal;
+ }
+ } else {
+ this._defaults.millisecMax = this.millisecMaxOriginal;
+ this._defaults.microsecMax = this.microsecMaxOriginal;
+ }
+ } else {
+ this._defaults.secondMax = this.secondMaxOriginal;
+ this._defaults.millisecMax = this.millisecMaxOriginal;
+ this._defaults.microsecMax = this.microsecMaxOriginal;
+ }
+ } else {
+ this._defaults.minuteMax = this.minuteMaxOriginal;
+ this._defaults.secondMax = this.secondMaxOriginal;
+ this._defaults.millisecMax = this.millisecMaxOriginal;
+ this._defaults.microsecMax = this.microsecMaxOriginal;
+ }
+ } else {
+ this._defaults.hourMax = this.hourMaxOriginal;
+ this._defaults.minuteMax = this.minuteMaxOriginal;
+ this._defaults.secondMax = this.secondMaxOriginal;
+ this._defaults.millisecMax = this.millisecMaxOriginal;
+ this._defaults.microsecMax = this.microsecMaxOriginal;
+ }
+ }
+
+ if (dp_inst.settings.minTime!==null) {
+ var tempMinTime=new Date("01/01/1970 " + dp_inst.settings.minTime);
+ if (this.hour
tempMaxTime.getHours()) {
+ this.hour=this._defaults.hourMax=tempMaxTime.getHours();
+ this.minute=this._defaults.minuteMax=tempMaxTime.getMinutes();
+ } else if (this.hour===tempMaxTime.getHours() && this.minute>tempMaxTime.getMinutes()) {
+ this.minute=this._defaults.minuteMax=tempMaxTime.getMinutes();
+ } else {
+ if (this._defaults.hourMax>tempMaxTime.getHours()) {
+ this._defaults.hourMax=tempMaxTime.getHours();
+ this._defaults.minuteMax=tempMaxTime.getMinutes();
+ } else if (this._defaults.hourMax===tempMaxTime.getHours()===this.hour && this._defaults.minuteMax>tempMaxTime.getMinutes()) {
+ this._defaults.minuteMax=tempMaxTime.getMinutes();
+ } else {
+ this._defaults.minuteMax=59;
+ }
+ }
+ }
+
+ if (adjustSliders !== undefined && adjustSliders === true) {
+ var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)), 10),
+ minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)), 10),
+ secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)), 10),
+ millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)), 10),
+ microsecMax = parseInt((this._defaults.microsecMax - ((this._defaults.microsecMax - this._defaults.microsecMin) % this._defaults.stepMicrosec)), 10);
+
+ if (this.hour_slider) {
+ this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax, step: this._defaults.stepHour });
+ this.control.value(this, this.hour_slider, 'hour', this.hour - (this.hour % this._defaults.stepHour));
+ }
+ if (this.minute_slider) {
+ this.control.options(this, this.minute_slider, 'minute', { min: this._defaults.minuteMin, max: minMax, step: this._defaults.stepMinute });
+ this.control.value(this, this.minute_slider, 'minute', this.minute - (this.minute % this._defaults.stepMinute));
+ }
+ if (this.second_slider) {
+ this.control.options(this, this.second_slider, 'second', { min: this._defaults.secondMin, max: secMax, step: this._defaults.stepSecond });
+ this.control.value(this, this.second_slider, 'second', this.second - (this.second % this._defaults.stepSecond));
+ }
+ if (this.millisec_slider) {
+ this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax, step: this._defaults.stepMillisec });
+ this.control.value(this, this.millisec_slider, 'millisec', this.millisec - (this.millisec % this._defaults.stepMillisec));
+ }
+ if (this.microsec_slider) {
+ this.control.options(this, this.microsec_slider, 'microsec', { min: this._defaults.microsecMin, max: microsecMax, step: this._defaults.stepMicrosec });
+ this.control.value(this, this.microsec_slider, 'microsec', this.microsec - (this.microsec % this._defaults.stepMicrosec));
+ }
+ }
+
+ },
+
+ /*
+ * when a slider moves, set the internal time...
+ * on time change is also called when the time is updated in the text field
+ */
+ _onTimeChange: function () {
+ if (!this._defaults.showTimepicker) {
+ return;
+ }
+ var hour = (this.hour_slider) ? this.control.value(this, this.hour_slider, 'hour') : false,
+ minute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false,
+ second = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false,
+ millisec = (this.millisec_slider) ? this.control.value(this, this.millisec_slider, 'millisec') : false,
+ microsec = (this.microsec_slider) ? this.control.value(this, this.microsec_slider, 'microsec') : false,
+ timezone = (this.timezone_select) ? this.timezone_select.val() : false,
+ o = this._defaults,
+ pickerTimeFormat = o.pickerTimeFormat || o.timeFormat,
+ pickerTimeSuffix = o.pickerTimeSuffix || o.timeSuffix;
+
+ if (typeof(hour) === 'object') {
+ hour = false;
+ }
+ if (typeof(minute) === 'object') {
+ minute = false;
+ }
+ if (typeof(second) === 'object') {
+ second = false;
+ }
+ if (typeof(millisec) === 'object') {
+ millisec = false;
+ }
+ if (typeof(microsec) === 'object') {
+ microsec = false;
+ }
+ if (typeof(timezone) === 'object') {
+ timezone = false;
+ }
+
+ if (hour !== false) {
+ hour = parseInt(hour, 10);
+ }
+ if (minute !== false) {
+ minute = parseInt(minute, 10);
+ }
+ if (second !== false) {
+ second = parseInt(second, 10);
+ }
+ if (millisec !== false) {
+ millisec = parseInt(millisec, 10);
+ }
+ if (microsec !== false) {
+ microsec = parseInt(microsec, 10);
+ }
+ if (timezone !== false) {
+ timezone = timezone.toString();
+ }
+
+ var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
+
+ // If the update was done in the input field, the input field should not be updated.
+ // If the update was done using the sliders, update the input field.
+ var hasChanged = (
+ hour !== parseInt(this.hour,10) || // sliders should all be numeric
+ minute !== parseInt(this.minute,10) ||
+ second !== parseInt(this.second,10) ||
+ millisec !== parseInt(this.millisec,10) ||
+ microsec !== parseInt(this.microsec,10) ||
+ (this.ampm.length > 0 && (hour < 12) !== ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1)) ||
+ (this.timezone !== null && timezone !== this.timezone.toString()) // could be numeric or "EST" format, so use toString()
+ );
+
+ if (hasChanged) {
+
+ if (hour !== false) {
+ this.hour = hour;
+ }
+ if (minute !== false) {
+ this.minute = minute;
+ }
+ if (second !== false) {
+ this.second = second;
+ }
+ if (millisec !== false) {
+ this.millisec = millisec;
+ }
+ if (microsec !== false) {
+ this.microsec = microsec;
+ }
+ if (timezone !== false) {
+ this.timezone = timezone;
+ }
+
+ if (!this.inst) {
+ this.inst = $.datepicker._getInst(this.$input[0]);
+ }
+
+ this._limitMinMaxDateTime(this.inst, true);
+ }
+ if (this.support.ampm) {
+ this.ampm = ampm;
+ }
+
+ // Updates the time within the timepicker
+ this.formattedTime = $.datepicker.formatTime(o.timeFormat, this, o);
+ if (this.$timeObj) {
+ if (pickerTimeFormat === o.timeFormat) {
+ this.$timeObj.val(this.formattedTime + pickerTimeSuffix);
+ }
+ else {
+ this.$timeObj.val($.datepicker.formatTime(pickerTimeFormat, this, o) + pickerTimeSuffix);
+ }
+ if (this.$timeObj[0].setSelectionRange) {
+ var sPos = this.$timeObj[0].selectionStart;
+ var ePos = this.$timeObj[0].selectionEnd;
+ this.$timeObj[0].setSelectionRange(sPos, ePos);
+ }
+ }
+
+ this.timeDefined = true;
+ if (hasChanged) {
+ this._updateDateTime();
+ //this.$input.focus(); // may automatically open the picker on setDate
+ }
+ },
+
+ /*
+ * call custom onSelect.
+ * bind to sliders slidestop, and grid click.
+ */
+ _onSelectHandler: function () {
+ var onSelect = this._defaults.onSelect || this.inst.settings.onSelect;
+ var inputEl = this.$input ? this.$input[0] : null;
+ if (onSelect && inputEl) {
+ onSelect.apply(inputEl, [this.formattedDateTime, this]);
+ }
+ },
+
+ /*
+ * update our input with the new date time..
+ */
+ _updateDateTime: function (dp_inst) {
+ dp_inst = this.inst || dp_inst;
+ var dtTmp = (dp_inst.currentYear > 0?
+ new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay) :
+ new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
+ dt = $.datepicker._daylightSavingAdjust(dtTmp),
+ //dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
+ //dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay)),
+ dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
+ formatCfg = $.datepicker._getFormatConfig(dp_inst),
+ timeAvailable = dt !== null && this.timeDefined;
+ this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
+ var formattedDateTime = this.formattedDate;
+
+ // if a slider was changed but datepicker doesn't have a value yet, set it
+ if (dp_inst.lastVal === "") {
+ dp_inst.currentYear = dp_inst.selectedYear;
+ dp_inst.currentMonth = dp_inst.selectedMonth;
+ dp_inst.currentDay = dp_inst.selectedDay;
+ }
+
+ /*
+ * remove following lines to force every changes in date picker to change the input value
+ * Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker.
+ * If the user manually empty the value in the input field, the date picker will never change selected value.
+ */
+ //if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) {
+ // return;
+ //}
+
+ if (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === false) {
+ formattedDateTime = this.formattedTime;
+ } else if ((this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) || (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === true)) {
+ formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
+ }
+
+ this.formattedDateTime = formattedDateTime;
+
+ if (!this._defaults.showTimepicker) {
+ this.$input.val(this.formattedDate);
+ } else if (this.$altInput && this._defaults.timeOnly === false && this._defaults.altFieldTimeOnly === true) {
+ this.$altInput.val(this.formattedTime);
+ this.$input.val(this.formattedDate);
+ } else if (this.$altInput) {
+ this.$input.val(formattedDateTime);
+ var altFormattedDateTime = '',
+ altSeparator = this._defaults.altSeparator !== null ? this._defaults.altSeparator : this._defaults.separator,
+ altTimeSuffix = this._defaults.altTimeSuffix !== null ? this._defaults.altTimeSuffix : this._defaults.timeSuffix;
+
+ if (!this._defaults.timeOnly) {
+ if (this._defaults.altFormat) {
+ altFormattedDateTime = $.datepicker.formatDate(this._defaults.altFormat, (dt === null ? new Date() : dt), formatCfg);
+ }
+ else {
+ altFormattedDateTime = this.formattedDate;
+ }
+
+ if (altFormattedDateTime) {
+ altFormattedDateTime += altSeparator;
+ }
+ }
+
+ if (this._defaults.altTimeFormat !== null) {
+ altFormattedDateTime += $.datepicker.formatTime(this._defaults.altTimeFormat, this, this._defaults) + altTimeSuffix;
+ }
+ else {
+ altFormattedDateTime += this.formattedTime + altTimeSuffix;
+ }
+ this.$altInput.val(altFormattedDateTime);
+ } else {
+ this.$input.val(formattedDateTime);
+ }
+
+ this.$input.trigger("change");
+ },
+
+ _onFocus: function () {
+ if (!this.$input.val() && this._defaults.defaultValue) {
+ this.$input.val(this._defaults.defaultValue);
+ var inst = $.datepicker._getInst(this.$input.get(0)),
+ tp_inst = $.datepicker._get(inst, 'timepicker');
+ if (tp_inst) {
+ if (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) {
+ try {
+ $.datepicker._updateDatepicker(inst);
+ } catch (err) {
+ $.timepicker.log(err);
+ }
+ }
+ }
+ }
+ },
+
+ /*
+ * Small abstraction to control types
+ * We can add more, just be sure to follow the pattern: create, options, value
+ */
+ _controls: {
+ // slider methods
+ slider: {
+ create: function (tp_inst, obj, unit, val, min, max, step) {
+ var rtl = tp_inst._defaults.isRTL; // if rtl go -60->0 instead of 0->60
+ return obj.prop('slide', null).slider({
+ orientation: "horizontal",
+ value: rtl ? val * -1 : val,
+ min: rtl ? max * -1 : min,
+ max: rtl ? min * -1 : max,
+ step: step,
+ slide: function (event, ui) {
+ tp_inst.control.value(tp_inst, $(this), unit, rtl ? ui.value * -1 : ui.value);
+ tp_inst._onTimeChange();
+ },
+ stop: function (event, ui) {
+ tp_inst._onSelectHandler();
+ }
+ });
+ },
+ options: function (tp_inst, obj, unit, opts, val) {
+ if (tp_inst._defaults.isRTL) {
+ if (typeof(opts) === 'string') {
+ if (opts === 'min' || opts === 'max') {
+ if (val !== undefined) {
+ return obj.slider(opts, val * -1);
+ }
+ return Math.abs(obj.slider(opts));
+ }
+ return obj.slider(opts);
+ }
+ var min = opts.min,
+ max = opts.max;
+ opts.min = opts.max = null;
+ if (min !== undefined) {
+ opts.max = min * -1;
+ }
+ if (max !== undefined) {
+ opts.min = max * -1;
+ }
+ return obj.slider(opts);
+ }
+ if (typeof(opts) === 'string' && val !== undefined) {
+ return obj.slider(opts, val);
+ }
+ return obj.slider(opts);
+ },
+ value: function (tp_inst, obj, unit, val) {
+ if (tp_inst._defaults.isRTL) {
+ if (val !== undefined) {
+ return obj.slider('value', val * -1);
+ }
+ return Math.abs(obj.slider('value'));
+ }
+ if (val !== undefined) {
+ return obj.slider('value', val);
+ }
+ return obj.slider('value');
+ }
+ },
+ // select methods
+ select: {
+ create: function (tp_inst, obj, unit, val, min, max, step) {
+ var sel = '',
+ format = tp_inst._defaults.pickerTimeFormat || tp_inst._defaults.timeFormat;
+
+ for (var i = min; i <= max; i += step) {
+ sel += '';
+ if (unit === 'hour') {
+ sel += $.datepicker.formatTime($.trim(format.replace(/[^ht ]/ig, '')), {hour: i}, tp_inst._defaults);
+ }
+ else if (unit === 'millisec' || unit === 'microsec' || i >= 10) { sel += i; }
+ else {sel += '0' + i.toString(); }
+ sel += ' ';
+ }
+ sel += ' ';
+
+ obj.children('select').remove();
+
+ $(sel).appendTo(obj).change(function (e) {
+ tp_inst._onTimeChange();
+ tp_inst._onSelectHandler();
+ tp_inst._afterInject();
+ });
+
+ return obj;
+ },
+ options: function (tp_inst, obj, unit, opts, val) {
+ var o = {},
+ $t = obj.children('select');
+ if (typeof(opts) === 'string') {
+ if (val === undefined) {
+ return $t.data(opts);
+ }
+ o[opts] = val;
+ }
+ else { o = opts; }
+ return tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min>=0 ? o.min : $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step'));
+ },
+ value: function (tp_inst, obj, unit, val) {
+ var $t = obj.children('select');
+ if (val !== undefined) {
+ return $t.val(val);
+ }
+ return $t.val();
+ }
+ }
+ } // end _controls
+
+ });
+
+ $.fn.extend({
+ /*
+ * shorthand just to use timepicker.
+ */
+ timepicker: function (o) {
+ o = o || {};
+ var tmp_args = Array.prototype.slice.call(arguments);
+
+ if (typeof o === 'object') {
+ tmp_args[0] = $.extend(o, {
+ timeOnly: true
+ });
+ }
+
+ return $(this).each(function () {
+ $.fn.datetimepicker.apply($(this), tmp_args);
+ });
+ },
+
+ /*
+ * extend timepicker to datepicker
+ */
+ datetimepicker: function (o) {
+ o = o || {};
+ var tmp_args = arguments;
+
+ if (typeof(o) === 'string') {
+ if (o === 'getDate' || (o === 'option' && tmp_args.length === 2 && typeof (tmp_args[1]) === 'string')) {
+ return $.fn.datepicker.apply($(this[0]), tmp_args);
+ } else {
+ return this.each(function () {
+ var $t = $(this);
+ $t.datepicker.apply($t, tmp_args);
+ });
+ }
+ } else {
+ return this.each(function () {
+ var $t = $(this);
+ $t.datepicker($.timepicker._newInst($t, o)._defaults);
+ });
+ }
+ }
+ });
+
+ /*
+ * Public Utility to parse date and time
+ */
+ $.datepicker.parseDateTime = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
+ var parseRes = parseDateTimeInternal(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings);
+ if (parseRes.timeObj) {
+ var t = parseRes.timeObj;
+ parseRes.date.setHours(t.hour, t.minute, t.second, t.millisec);
+ parseRes.date.setMicroseconds(t.microsec);
+ }
+
+ return parseRes.date;
+ };
+
+ /*
+ * Public utility to parse time
+ */
+ $.datepicker.parseTime = function (timeFormat, timeString, options) {
+ var o = extendRemove(extendRemove({}, $.timepicker._defaults), options || {}),
+ iso8601 = (timeFormat.replace(/\'.*?\'/g, '').indexOf('Z') !== -1);
+
+ // Strict parse requires the timeString to match the timeFormat exactly
+ var strictParse = function (f, s, o) {
+
+ // pattern for standard and localized AM/PM markers
+ var getPatternAmpm = function (amNames, pmNames) {
+ var markers = [];
+ if (amNames) {
+ $.merge(markers, amNames);
+ }
+ if (pmNames) {
+ $.merge(markers, pmNames);
+ }
+ markers = $.map(markers, function (val) {
+ return val.replace(/[.*+?|()\[\]{}\\]/g, '\\$&');
+ });
+ return '(' + markers.join('|') + ')?';
+ };
+
+ // figure out position of time elements.. cause js cant do named captures
+ var getFormatPositions = function (timeFormat) {
+ var finds = timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),
+ orders = {
+ h: -1,
+ m: -1,
+ s: -1,
+ l: -1,
+ c: -1,
+ t: -1,
+ z: -1
+ };
+
+ if (finds) {
+ for (var i = 0; i < finds.length; i++) {
+ if (orders[finds[i].toString().charAt(0)] === -1) {
+ orders[finds[i].toString().charAt(0)] = i + 1;
+ }
+ }
+ }
+ return orders;
+ };
+
+ var regstr = '^' + f.toString()
+ .replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {
+ var ml = match.length;
+ switch (match.charAt(0).toLowerCase()) {
+ case 'h':
+ return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
+ case 'm':
+ return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
+ case 's':
+ return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
+ case 'l':
+ return '(\\d?\\d?\\d)';
+ case 'c':
+ return '(\\d?\\d?\\d)';
+ case 'z':
+ return '(z|[-+]\\d\\d:?\\d\\d|\\S+)?';
+ case 't':
+ return getPatternAmpm(o.amNames, o.pmNames);
+ default: // literal escaped in quotes
+ return '(' + match.replace(/\'/g, "").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g, function (m) { return "\\" + m; }) + ')?';
+ }
+ })
+ .replace(/\s/g, '\\s?') +
+ o.timeSuffix + '$',
+ order = getFormatPositions(f),
+ ampm = '',
+ treg;
+
+ treg = s.match(new RegExp(regstr, 'i'));
+
+ var resTime = {
+ hour: 0,
+ minute: 0,
+ second: 0,
+ millisec: 0,
+ microsec: 0
+ };
+
+ if (treg) {
+ if (order.t !== -1) {
+ if (treg[order.t] === undefined || treg[order.t].length === 0) {
+ ampm = '';
+ resTime.ampm = '';
+ } else {
+ ampm = $.inArray(treg[order.t].toUpperCase(), $.map(o.amNames, function (x,i) { return x.toUpperCase(); })) !== -1 ? 'AM' : 'PM';
+ resTime.ampm = o[ampm === 'AM' ? 'amNames' : 'pmNames'][0];
+ }
+ }
+
+ if (order.h !== -1) {
+ if (ampm === 'AM' && treg[order.h] === '12') {
+ resTime.hour = 0; // 12am = 0 hour
+ } else {
+ if (ampm === 'PM' && treg[order.h] !== '12') {
+ resTime.hour = parseInt(treg[order.h], 10) + 12; // 12pm = 12 hour, any other pm = hour + 12
+ } else {
+ resTime.hour = Number(treg[order.h]);
+ }
+ }
+ }
+
+ if (order.m !== -1) {
+ resTime.minute = Number(treg[order.m]);
+ }
+ if (order.s !== -1) {
+ resTime.second = Number(treg[order.s]);
+ }
+ if (order.l !== -1) {
+ resTime.millisec = Number(treg[order.l]);
+ }
+ if (order.c !== -1) {
+ resTime.microsec = Number(treg[order.c]);
+ }
+ if (order.z !== -1 && treg[order.z] !== undefined) {
+ resTime.timezone = $.timepicker.timezoneOffsetNumber(treg[order.z]);
+ }
+
+
+ return resTime;
+ }
+ return false;
+ };// end strictParse
+
+ // First try JS Date, if that fails, use strictParse
+ var looseParse = function (f, s, o) {
+ try {
+ var d = new Date('2012-01-01 ' + s);
+ if (isNaN(d.getTime())) {
+ d = new Date('2012-01-01T' + s);
+ if (isNaN(d.getTime())) {
+ d = new Date('01/01/2012 ' + s);
+ if (isNaN(d.getTime())) {
+ throw "Unable to parse time with native Date: " + s;
+ }
+ }
+ }
+
+ return {
+ hour: d.getHours(),
+ minute: d.getMinutes(),
+ second: d.getSeconds(),
+ millisec: d.getMilliseconds(),
+ microsec: d.getMicroseconds(),
+ timezone: d.getTimezoneOffset() * -1
+ };
+ }
+ catch (err) {
+ try {
+ return strictParse(f, s, o);
+ }
+ catch (err2) {
+ $.timepicker.log("Unable to parse \ntimeString: " + s + "\ntimeFormat: " + f);
+ }
+ }
+ return false;
+ }; // end looseParse
+
+ if (typeof o.parse === "function") {
+ return o.parse(timeFormat, timeString, o);
+ }
+ if (o.parse === 'loose') {
+ return looseParse(timeFormat, timeString, o);
+ }
+ return strictParse(timeFormat, timeString, o);
+ };
+
+ /**
+ * Public utility to format the time
+ * @param {string} format format of the time
+ * @param {Object} time Object not a Date for timezones
+ * @param {Object} [options] essentially the regional[].. amNames, pmNames, ampm
+ * @returns {string} the formatted time
+ */
+ $.datepicker.formatTime = function (format, time, options) {
+ options = options || {};
+ options = $.extend({}, $.timepicker._defaults, options);
+ time = $.extend({
+ hour: 0,
+ minute: 0,
+ second: 0,
+ millisec: 0,
+ microsec: 0,
+ timezone: null
+ }, time);
+
+ var tmptime = format,
+ ampmName = options.amNames[0],
+ hour = parseInt(time.hour, 10);
+
+ if (hour > 11) {
+ ampmName = options.pmNames[0];
+ }
+
+ tmptime = tmptime.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {
+ switch (match) {
+ case 'HH':
+ return ('0' + hour).slice(-2);
+ case 'H':
+ return hour;
+ case 'hh':
+ return ('0' + convert24to12(hour)).slice(-2);
+ case 'h':
+ return convert24to12(hour);
+ case 'mm':
+ return ('0' + time.minute).slice(-2);
+ case 'm':
+ return time.minute;
+ case 'ss':
+ return ('0' + time.second).slice(-2);
+ case 's':
+ return time.second;
+ case 'l':
+ return ('00' + time.millisec).slice(-3);
+ case 'c':
+ return ('00' + time.microsec).slice(-3);
+ case 'z':
+ return $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, false);
+ case 'Z':
+ return $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, true);
+ case 'T':
+ return ampmName.charAt(0).toUpperCase();
+ case 'TT':
+ return ampmName.toUpperCase();
+ case 't':
+ return ampmName.charAt(0).toLowerCase();
+ case 'tt':
+ return ampmName.toLowerCase();
+ default:
+ return match.replace(/'/g, "");
+ }
+ });
+
+ return tmptime;
+ };
+
+ /*
+ * the bad hack :/ override datepicker so it doesn't close on select
+ // inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378
+ */
+ $.datepicker._base_selectDate = $.datepicker._selectDate;
+ $.datepicker._selectDate = function (id, dateStr) {
+ var inst = this._getInst($(id)[0]),
+ tp_inst = this._get(inst, 'timepicker'),
+ was_inline;
+
+ if (tp_inst && inst.settings.showTimepicker) {
+ tp_inst._limitMinMaxDateTime(inst, true);
+ was_inline = inst.inline;
+ inst.inline = inst.stay_open = true;
+ //This way the onSelect handler called from calendarpicker get the full dateTime
+ this._base_selectDate(id, dateStr);
+ inst.inline = was_inline;
+ inst.stay_open = false;
+ this._notifyChange(inst);
+ this._updateDatepicker(inst);
+ } else {
+ this._base_selectDate(id, dateStr);
+ }
+ };
+
+ /*
+ * second bad hack :/ override datepicker so it triggers an event when changing the input field
+ * and does not redraw the datepicker on every selectDate event
+ */
+ $.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;
+ $.datepicker._updateDatepicker = function (inst) {
+
+ // don't popup the datepicker if there is another instance already opened
+ var input = inst.input[0];
+ if ($.datepicker._curInst && $.datepicker._curInst !== inst && $.datepicker._datepickerShowing && $.datepicker._lastInput !== input) {
+ return;
+ }
+
+ if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
+
+ this._base_updateDatepicker(inst);
+
+ // Reload the time control when changing something in the input text field.
+ var tp_inst = this._get(inst, 'timepicker');
+ if (tp_inst) {
+ tp_inst._addTimePicker(inst);
+ }
+ }
+ };
+
+ /*
+ * third bad hack :/ override datepicker so it allows spaces and colon in the input field
+ */
+ $.datepicker._base_doKeyPress = $.datepicker._doKeyPress;
+ $.datepicker._doKeyPress = function (event) {
+ var inst = $.datepicker._getInst(event.target),
+ tp_inst = $.datepicker._get(inst, 'timepicker');
+
+ if (tp_inst) {
+ if ($.datepicker._get(inst, 'constrainInput')) {
+ var ampm = tp_inst.support.ampm,
+ tz = tp_inst._defaults.showTimezone !== null ? tp_inst._defaults.showTimezone : tp_inst.support.timezone,
+ dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
+ datetimeChars = tp_inst._defaults.timeFormat.toString()
+ .replace(/[hms]/g, '')
+ .replace(/TT/g, ampm ? 'APM' : '')
+ .replace(/Tt/g, ampm ? 'AaPpMm' : '')
+ .replace(/tT/g, ampm ? 'AaPpMm' : '')
+ .replace(/T/g, ampm ? 'AP' : '')
+ .replace(/tt/g, ampm ? 'apm' : '')
+ .replace(/t/g, ampm ? 'ap' : '') +
+ " " + tp_inst._defaults.separator +
+ tp_inst._defaults.timeSuffix +
+ (tz ? tp_inst._defaults.timezoneList.join('') : '') +
+ (tp_inst._defaults.amNames.join('')) + (tp_inst._defaults.pmNames.join('')) +
+ dateChars,
+ chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
+ return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
+ }
+ }
+
+ return $.datepicker._base_doKeyPress(event);
+ };
+
+ /*
+ * Fourth bad hack :/ override _updateAlternate function used in inline mode to init altField
+ * Update any alternate field to synchronise with the main field.
+ */
+ $.datepicker._base_updateAlternate = $.datepicker._updateAlternate;
+ $.datepicker._updateAlternate = function (inst) {
+ var tp_inst = this._get(inst, 'timepicker');
+ if (tp_inst) {
+ var altField = tp_inst._defaults.altField;
+ if (altField) { // update alternate field too
+ var altFormat = tp_inst._defaults.altFormat || tp_inst._defaults.dateFormat,
+ date = this._getDate(inst),
+ formatCfg = $.datepicker._getFormatConfig(inst),
+ altFormattedDateTime = '',
+ altSeparator = tp_inst._defaults.altSeparator ? tp_inst._defaults.altSeparator : tp_inst._defaults.separator,
+ altTimeSuffix = tp_inst._defaults.altTimeSuffix ? tp_inst._defaults.altTimeSuffix : tp_inst._defaults.timeSuffix,
+ altTimeFormat = tp_inst._defaults.altTimeFormat !== null ? tp_inst._defaults.altTimeFormat : tp_inst._defaults.timeFormat;
+
+ altFormattedDateTime += $.datepicker.formatTime(altTimeFormat, tp_inst, tp_inst._defaults) + altTimeSuffix;
+ if (!tp_inst._defaults.timeOnly && !tp_inst._defaults.altFieldTimeOnly && date !== null) {
+ if (tp_inst._defaults.altFormat) {
+ altFormattedDateTime = $.datepicker.formatDate(tp_inst._defaults.altFormat, date, formatCfg) + altSeparator + altFormattedDateTime;
+ }
+ else {
+ altFormattedDateTime = tp_inst.formattedDate + altSeparator + altFormattedDateTime;
+ }
+ }
+ $(altField).val( inst.input.val() ? altFormattedDateTime : "");
+ }
+ }
+ else {
+ $.datepicker._base_updateAlternate(inst);
+ }
+ };
+
+ /*
+ * Override key up event to sync manual input changes.
+ */
+ $.datepicker._base_doKeyUp = $.datepicker._doKeyUp;
+ $.datepicker._doKeyUp = function (event) {
+ var inst = $.datepicker._getInst(event.target),
+ tp_inst = $.datepicker._get(inst, 'timepicker');
+
+ if (tp_inst) {
+ if (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) {
+ try {
+ $.datepicker._updateDatepicker(inst);
+ } catch (err) {
+ $.timepicker.log(err);
+ }
+ }
+ }
+
+ return $.datepicker._base_doKeyUp(event);
+ };
+
+ /*
+ * override "Today" button to also grab the time and set it to input field.
+ */
+ $.datepicker._base_gotoToday = $.datepicker._gotoToday;
+ $.datepicker._gotoToday = function (id) {
+ var inst = this._getInst($(id)[0]);
+ this._base_gotoToday(id);
+ var tp_inst = this._get(inst, 'timepicker');
+ if (!tp_inst) {
+ return;
+ }
+
+ var tzoffset = $.timepicker.timezoneOffsetNumber(tp_inst.timezone);
+ var now = new Date();
+ now.setMinutes(now.getMinutes() + now.getTimezoneOffset() + parseInt(tzoffset, 10));
+ this._setTime(inst, now);
+ this._setDate(inst, now);
+ tp_inst._onSelectHandler();
+ };
+
+ /*
+ * Disable & enable the Time in the datetimepicker
+ */
+ $.datepicker._disableTimepickerDatepicker = function (target) {
+ var inst = this._getInst(target);
+ if (!inst) {
+ return;
+ }
+
+ var tp_inst = this._get(inst, 'timepicker');
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
+ if (tp_inst) {
+ inst.settings.showTimepicker = false;
+ tp_inst._defaults.showTimepicker = false;
+ tp_inst._updateDateTime(inst);
+ }
+ };
+
+ $.datepicker._enableTimepickerDatepicker = function (target) {
+ var inst = this._getInst(target);
+ if (!inst) {
+ return;
+ }
+
+ var tp_inst = this._get(inst, 'timepicker');
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
+ if (tp_inst) {
+ inst.settings.showTimepicker = true;
+ tp_inst._defaults.showTimepicker = true;
+ tp_inst._addTimePicker(inst); // Could be disabled on page load
+ tp_inst._updateDateTime(inst);
+ }
+ };
+
+ /*
+ * Create our own set time function
+ */
+ $.datepicker._setTime = function (inst, date) {
+ var tp_inst = this._get(inst, 'timepicker');
+ if (tp_inst) {
+ var defaults = tp_inst._defaults;
+
+ // calling _setTime with no date sets time to defaults
+ tp_inst.hour = date ? date.getHours() : defaults.hour;
+ tp_inst.minute = date ? date.getMinutes() : defaults.minute;
+ tp_inst.second = date ? date.getSeconds() : defaults.second;
+ tp_inst.millisec = date ? date.getMilliseconds() : defaults.millisec;
+ tp_inst.microsec = date ? date.getMicroseconds() : defaults.microsec;
+
+ //check if within min/max times..
+ tp_inst._limitMinMaxDateTime(inst, true);
+
+ tp_inst._onTimeChange();
+ tp_inst._updateDateTime(inst);
+ }
+ };
+
+ /*
+ * Create new public method to set only time, callable as $().datepicker('setTime', date)
+ */
+ $.datepicker._setTimeDatepicker = function (target, date, withDate) {
+ var inst = this._getInst(target);
+ if (!inst) {
+ return;
+ }
+
+ var tp_inst = this._get(inst, 'timepicker');
+
+ if (tp_inst) {
+ this._setDateFromField(inst);
+ var tp_date;
+ if (date) {
+ if (typeof date === "string") {
+ tp_inst._parseTime(date, withDate);
+ tp_date = new Date();
+ tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
+ tp_date.setMicroseconds(tp_inst.microsec);
+ } else {
+ tp_date = new Date(date.getTime());
+ tp_date.setMicroseconds(date.getMicroseconds());
+ }
+ if (tp_date.toString() === 'Invalid Date') {
+ tp_date = undefined;
+ }
+ this._setTime(inst, tp_date);
+ }
+ }
+
+ };
+
+ /*
+ * override setDate() to allow setting time too within Date object
+ */
+ $.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
+ $.datepicker._setDateDatepicker = function (target, _date) {
+ var inst = this._getInst(target);
+ var date = _date;
+ if (!inst) {
+ return;
+ }
+
+ if (typeof(_date) === 'string') {
+ date = new Date(_date);
+ if (!date.getTime()) {
+ this._base_setDateDatepicker.apply(this, arguments);
+ date = $(target).datepicker('getDate');
+ }
+ }
+
+ var tp_inst = this._get(inst, 'timepicker');
+ var tp_date;
+ if (date instanceof Date) {
+ tp_date = new Date(date.getTime());
+ tp_date.setMicroseconds(date.getMicroseconds());
+ } else {
+ tp_date = date;
+ }
+
+ // This is important if you are using the timezone option, javascript's Date
+ // object will only return the timezone offset for the current locale, so we
+ // adjust it accordingly. If not using timezone option this won't matter..
+ // If a timezone is different in tp, keep the timezone as is
+ if (tp_inst && tp_date) {
+ // look out for DST if tz wasn't specified
+ if (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) {
+ tp_inst.timezone = tp_date.getTimezoneOffset() * -1;
+ }
+ date = $.timepicker.timezoneAdjust(date, $.timepicker.timezoneOffsetString(-date.getTimezoneOffset()), tp_inst.timezone);
+ tp_date = $.timepicker.timezoneAdjust(tp_date, $.timepicker.timezoneOffsetString(-tp_date.getTimezoneOffset()), tp_inst.timezone);
+ }
+
+ this._updateDatepicker(inst);
+ this._base_setDateDatepicker.apply(this, arguments);
+ this._setTimeDatepicker(target, tp_date, true);
+ };
+
+ /*
+ * override getDate() to allow getting time too within Date object
+ */
+ $.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;
+ $.datepicker._getDateDatepicker = function (target, noDefault) {
+ var inst = this._getInst(target);
+ if (!inst) {
+ return;
+ }
+
+ var tp_inst = this._get(inst, 'timepicker');
+
+ if (tp_inst) {
+ // if it hasn't yet been defined, grab from field
+ if (inst.lastVal === undefined) {
+ this._setDateFromField(inst, noDefault);
+ }
+
+ var date = this._getDate(inst);
+
+ var currDT = null;
+
+ if (tp_inst.$altInput && tp_inst._defaults.altFieldTimeOnly) {
+ currDT = tp_inst.$input.val() + ' ' + tp_inst.$altInput.val();
+ }
+ else if (tp_inst.$input.get(0).tagName !== 'INPUT' && tp_inst.$altInput) {
+ /**
+ * in case the datetimepicker has been applied to a non-input tag for inline UI,
+ * and the user has not configured the plugin to display only time in altInput,
+ * pick current date time from the altInput (and hope for the best, for now, until "ER1" is applied)
+ *
+ * @todo ER1. Since altInput can have a totally difference format, convert it to standard format by reading input format from "altFormat" and "altTimeFormat" option values
+ */
+ currDT = tp_inst.$altInput.val();
+ }
+ else {
+ currDT = tp_inst.$input.val();
+ }
+
+ if (date && tp_inst._parseTime(currDT, !inst.settings.timeOnly)) {
+ date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
+ date.setMicroseconds(tp_inst.microsec);
+
+ // This is important if you are using the timezone option, javascript's Date
+ // object will only return the timezone offset for the current locale, so we
+ // adjust it accordingly. If not using timezone option this won't matter..
+ if (tp_inst.timezone != null) {
+ // look out for DST if tz wasn't specified
+ if (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) {
+ tp_inst.timezone = date.getTimezoneOffset() * -1;
+ }
+ date = $.timepicker.timezoneAdjust(date, tp_inst.timezone, $.timepicker.timezoneOffsetString(-date.getTimezoneOffset()));
+ }
+ }
+ return date;
+ }
+ return this._base_getDateDatepicker(target, noDefault);
+ };
+
+ /*
+ * override parseDate() because UI 1.8.14 throws an error about "Extra characters"
+ * An option in datapicker to ignore extra format characters would be nicer.
+ */
+ $.datepicker._base_parseDate = $.datepicker.parseDate;
+ $.datepicker.parseDate = function (format, value, settings) {
+ var date;
+ try {
+ date = this._base_parseDate(format, value, settings);
+ } catch (err) {
+ // Hack! The error message ends with a colon, a space, and
+ // the "extra" characters. We rely on that instead of
+ // attempting to perfectly reproduce the parsing algorithm.
+ if (err.indexOf(":") >= 0) {
+ date = this._base_parseDate(format, value.substring(0, value.length - (err.length - err.indexOf(':') - 2)), settings);
+ $.timepicker.log("Error parsing the date string: " + err + "\ndate string = " + value + "\ndate format = " + format);
+ } else {
+ throw err;
+ }
+ }
+ return date;
+ };
+
+ /*
+ * override formatDate to set date with time to the input
+ */
+ $.datepicker._base_formatDate = $.datepicker._formatDate;
+ $.datepicker._formatDate = function (inst, day, month, year) {
+ var tp_inst = this._get(inst, 'timepicker');
+ if (tp_inst) {
+ tp_inst._updateDateTime(inst);
+ return tp_inst.$input.val();
+ }
+ return this._base_formatDate(inst);
+ };
+
+ /*
+ * override options setter to add time to maxDate(Time) and minDate(Time). MaxDate
+ */
+ $.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;
+ $.datepicker._optionDatepicker = function (target, name, value) {
+ var inst = this._getInst(target),
+ name_clone;
+ if (!inst) {
+ return null;
+ }
+
+ var tp_inst = this._get(inst, 'timepicker');
+ if (tp_inst) {
+ var min = null,
+ max = null,
+ onselect = null,
+ overrides = tp_inst._defaults.evnts,
+ fns = {},
+ prop,
+ ret,
+ oldVal,
+ $target;
+ if (typeof name === 'string') { // if min/max was set with the string
+ if (name === 'minDate' || name === 'minDateTime') {
+ min = value;
+ } else if (name === 'maxDate' || name === 'maxDateTime') {
+ max = value;
+ } else if (name === 'onSelect') {
+ onselect = value;
+ } else if (overrides.hasOwnProperty(name)) {
+ if (typeof (value) === 'undefined') {
+ return overrides[name];
+ }
+ fns[name] = value;
+ name_clone = {}; //empty results in exiting function after overrides updated
+ }
+ } else if (typeof name === 'object') { //if min/max was set with the JSON
+ if (name.minDate) {
+ min = name.minDate;
+ } else if (name.minDateTime) {
+ min = name.minDateTime;
+ } else if (name.maxDate) {
+ max = name.maxDate;
+ } else if (name.maxDateTime) {
+ max = name.maxDateTime;
+ }
+ for (prop in overrides) {
+ if (overrides.hasOwnProperty(prop) && name[prop]) {
+ fns[prop] = name[prop];
+ }
+ }
+ }
+ for (prop in fns) {
+ if (fns.hasOwnProperty(prop)) {
+ overrides[prop] = fns[prop];
+ if (!name_clone) { name_clone = $.extend({}, name); }
+ delete name_clone[prop];
+ }
+ }
+ if (name_clone && isEmptyObject(name_clone)) { return; }
+ if (min) { //if min was set
+ if (min === 0) {
+ min = new Date();
+ } else {
+ min = new Date(min);
+ }
+ tp_inst._defaults.minDate = min;
+ tp_inst._defaults.minDateTime = min;
+ } else if (max) { //if max was set
+ if (max === 0) {
+ max = new Date();
+ } else {
+ max = new Date(max);
+ }
+ tp_inst._defaults.maxDate = max;
+ tp_inst._defaults.maxDateTime = max;
+ } else if (onselect) {
+ tp_inst._defaults.onSelect = onselect;
+ }
+
+ // Datepicker will override our date when we call _base_optionDatepicker when
+ // calling minDate/maxDate, so we will first grab the value, call
+ // _base_optionDatepicker, then set our value back.
+ if(min || max){
+ $target = $(target);
+ oldVal = $target.datetimepicker('getDate');
+ ret = this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
+ $target.datetimepicker('setDate', oldVal);
+ return ret;
+ }
+ }
+ if (value === undefined) {
+ return this._base_optionDatepicker.call($.datepicker, target, name);
+ }
+ return this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
+ };
+
+ /*
+ * jQuery isEmptyObject does not check hasOwnProperty - if someone has added to the object prototype,
+ * it will return false for all objects
+ */
+ var isEmptyObject = function (obj) {
+ var prop;
+ for (prop in obj) {
+ if (obj.hasOwnProperty(prop)) {
+ return false;
+ }
+ }
+ return true;
+ };
+
+ /*
+ * jQuery extend now ignores nulls!
+ */
+ var extendRemove = function (target, props) {
+ $.extend(target, props);
+ for (var name in props) {
+ if (props[name] === null || props[name] === undefined) {
+ target[name] = props[name];
+ }
+ }
+ return target;
+ };
+
+ /*
+ * Determine by the time format which units are supported
+ * Returns an object of booleans for each unit
+ */
+ var detectSupport = function (timeFormat) {
+ var tf = timeFormat.replace(/'.*?'/g, '').toLowerCase(), // removes literals
+ isIn = function (f, t) { // does the format contain the token?
+ return f.indexOf(t) !== -1 ? true : false;
+ };
+ return {
+ hour: isIn(tf, 'h'),
+ minute: isIn(tf, 'm'),
+ second: isIn(tf, 's'),
+ millisec: isIn(tf, 'l'),
+ microsec: isIn(tf, 'c'),
+ timezone: isIn(tf, 'z'),
+ ampm: isIn(tf, 't') && isIn(timeFormat, 'h'),
+ iso8601: isIn(timeFormat, 'Z')
+ };
+ };
+
+ /*
+ * Converts 24 hour format into 12 hour
+ * Returns 12 hour without leading 0
+ */
+ var convert24to12 = function (hour) {
+ hour %= 12;
+
+ if (hour === 0) {
+ hour = 12;
+ }
+
+ return String(hour);
+ };
+
+ var computeEffectiveSetting = function (settings, property) {
+ return settings && settings[property] ? settings[property] : $.timepicker._defaults[property];
+ };
+
+ /*
+ * Splits datetime string into date and time substrings.
+ * Throws exception when date can't be parsed
+ * Returns {dateString: dateString, timeString: timeString}
+ */
+ var splitDateTime = function (dateTimeString, timeSettings) {
+ // The idea is to get the number separator occurrences in datetime and the time format requested (since time has
+ // fewer unknowns, mostly numbers and am/pm). We will use the time pattern to split.
+ var separator = computeEffectiveSetting(timeSettings, 'separator'),
+ format = computeEffectiveSetting(timeSettings, 'timeFormat'),
+ timeParts = format.split(separator), // how many occurrences of separator may be in our format?
+ timePartsLen = timeParts.length,
+ allParts = dateTimeString.split(separator),
+ allPartsLen = allParts.length;
+
+ if (allPartsLen > 1) {
+ return {
+ dateString: allParts.splice(0, allPartsLen - timePartsLen).join(separator),
+ timeString: allParts.splice(0, timePartsLen).join(separator)
+ };
+ }
+
+ return {
+ dateString: dateTimeString,
+ timeString: ''
+ };
+ };
+
+ /*
+ * Internal function to parse datetime interval
+ * Returns: {date: Date, timeObj: Object}, where
+ * date - parsed date without time (type Date)
+ * timeObj = {hour: , minute: , second: , millisec: , microsec: } - parsed time. Optional
+ */
+ var parseDateTimeInternal = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
+ var date,
+ parts,
+ parsedTime;
+
+ parts = splitDateTime(dateTimeString, timeSettings);
+ date = $.datepicker._base_parseDate(dateFormat, parts.dateString, dateSettings);
+
+ if (parts.timeString === '') {
+ return {
+ date: date
+ };
+ }
+
+ parsedTime = $.datepicker.parseTime(timeFormat, parts.timeString, timeSettings);
+
+ if (!parsedTime) {
+ throw 'Wrong time format';
+ }
+
+ return {
+ date: date,
+ timeObj: parsedTime
+ };
+ };
+
+ /*
+ * Internal function to set timezone_select to the local timezone
+ */
+ var selectLocalTimezone = function (tp_inst, date) {
+ if (tp_inst && tp_inst.timezone_select) {
+ var now = date || new Date();
+ tp_inst.timezone_select.val(-now.getTimezoneOffset());
+ }
+ };
+
+ /*
+ * Create a Singleton Instance
+ */
+ $.timepicker = new Timepicker();
+
+ /**
+ * Get the timezone offset as string from a date object (eg '+0530' for UTC+5.5)
+ * @param {number} tzMinutes if not a number, less than -720 (-1200), or greater than 840 (+1400) this value is returned
+ * @param {boolean} iso8601 if true formats in accordance to iso8601 "+12:45"
+ * @return {string}
+ */
+ $.timepicker.timezoneOffsetString = function (tzMinutes, iso8601) {
+ if (isNaN(tzMinutes) || tzMinutes > 840 || tzMinutes < -720) {
+ return tzMinutes;
+ }
+
+ var off = tzMinutes,
+ minutes = off % 60,
+ hours = (off - minutes) / 60,
+ iso = iso8601 ? ':' : '',
+ tz = (off >= 0 ? '+' : '-') + ('0' + Math.abs(hours)).slice(-2) + iso + ('0' + Math.abs(minutes)).slice(-2);
+
+ if (tz === '+00:00') {
+ return 'Z';
+ }
+ return tz;
+ };
+
+ /**
+ * Get the number in minutes that represents a timezone string
+ * @param {string} tzString formatted like "+0500", "-1245", "Z"
+ * @return {number} the offset minutes or the original string if it doesn't match expectations
+ */
+ $.timepicker.timezoneOffsetNumber = function (tzString) {
+ var normalized = tzString.toString().replace(':', ''); // excuse any iso8601, end up with "+1245"
+
+ if (normalized.toUpperCase() === 'Z') { // if iso8601 with Z, its 0 minute offset
+ return 0;
+ }
+
+ if (!/^(\-|\+)\d{4}$/.test(normalized)) { // possibly a user defined tz, so just give it back
+ return parseInt(tzString, 10);
+ }
+
+ return ((normalized.substr(0, 1) === '-' ? -1 : 1) * // plus or minus
+ ((parseInt(normalized.substr(1, 2), 10) * 60) + // hours (converted to minutes)
+ parseInt(normalized.substr(3, 2), 10))); // minutes
+ };
+
+ /**
+ * No way to set timezone in js Date, so we must adjust the minutes to compensate. (think setDate, getDate)
+ * @param {Date} date
+ * @param {string} fromTimezone formatted like "+0500", "-1245"
+ * @param {string} toTimezone formatted like "+0500", "-1245"
+ * @return {Date}
+ */
+ $.timepicker.timezoneAdjust = function (date, fromTimezone, toTimezone) {
+ var fromTz = $.timepicker.timezoneOffsetNumber(fromTimezone);
+ var toTz = $.timepicker.timezoneOffsetNumber(toTimezone);
+ if (!isNaN(toTz)) {
+ date.setMinutes(date.getMinutes() + (-fromTz) - (-toTz));
+ }
+ return date;
+ };
+
+ /**
+ * Calls `timepicker()` on the `startTime` and `endTime` elements, and configures them to
+ * enforce date range limits.
+ * n.b. The input value must be correctly formatted (reformatting is not supported)
+ * @param {Element} startTime
+ * @param {Element} endTime
+ * @param {Object} options Options for the timepicker() call
+ * @return {jQuery}
+ */
+ $.timepicker.timeRange = function (startTime, endTime, options) {
+ return $.timepicker.handleRange('timepicker', startTime, endTime, options);
+ };
+
+ /**
+ * Calls `datetimepicker` on the `startTime` and `endTime` elements, and configures them to
+ * enforce date range limits.
+ * @param {Element} startTime
+ * @param {Element} endTime
+ * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
+ * @param {string} method Can be used to specify the type of picker to be added
+ * @return {jQuery}
+ */
+ $.timepicker.datetimeRange = function (startTime, endTime, options) {
+ $.timepicker.handleRange('datetimepicker', startTime, endTime, options);
+ };
+
+ /**
+ * Calls `datepicker` on the `startTime` and `endTime` elements, and configures them to
+ * enforce date range limits.
+ * @param {Element} startTime
+ * @param {Element} endTime
+ * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
+ * @return {jQuery}
+ */
+ $.timepicker.dateRange = function (startTime, endTime, options) {
+ $.timepicker.handleRange('datepicker', startTime, endTime, options);
+ };
+
+ /**
+ * Calls `method` on the `startTime` and `endTime` elements, and configures them to
+ * enforce date range limits.
+ * @param {string} method Can be used to specify the type of picker to be added
+ * @param {Element} startTime
+ * @param {Element} endTime
+ * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
+ * @return {jQuery}
+ */
+ $.timepicker.handleRange = function (method, startTime, endTime, options) {
+ options = $.extend({}, {
+ minInterval: 0, // min allowed interval in milliseconds
+ maxInterval: 0, // max allowed interval in milliseconds
+ start: {}, // options for start picker
+ end: {} // options for end picker
+ }, options);
+
+ // for the mean time this fixes an issue with calling getDate with timepicker()
+ var timeOnly = false;
+ if(method === 'timepicker'){
+ timeOnly = true;
+ method = 'datetimepicker';
+ }
+
+ function checkDates(changed, other) {
+ var startdt = startTime[method]('getDate'),
+ enddt = endTime[method]('getDate'),
+ changeddt = changed[method]('getDate');
+
+ if (startdt !== null) {
+ var minDate = new Date(startdt.getTime()),
+ maxDate = new Date(startdt.getTime());
+
+ minDate.setMilliseconds(minDate.getMilliseconds() + options.minInterval);
+ maxDate.setMilliseconds(maxDate.getMilliseconds() + options.maxInterval);
+
+ if (options.minInterval > 0 && minDate > enddt) { // minInterval check
+ endTime[method]('setDate', minDate);
+ }
+ else if (options.maxInterval > 0 && maxDate < enddt) { // max interval check
+ endTime[method]('setDate', maxDate);
+ }
+ else if (startdt > enddt) {
+ other[method]('setDate', changeddt);
+ }
+ }
+ }
+
+ function selected(changed, other, option) {
+ if (!changed.val()) {
+ return;
+ }
+ var date = changed[method].call(changed, 'getDate');
+ if (date !== null && options.minInterval > 0) {
+ if (option === 'minDate') {
+ date.setMilliseconds(date.getMilliseconds() + options.minInterval);
+ }
+ if (option === 'maxDate') {
+ date.setMilliseconds(date.getMilliseconds() - options.minInterval);
+ }
+ }
+
+ if (date.getTime) {
+ other[method].call(other, 'option', option, date);
+ }
+ }
+
+ $.fn[method].call(startTime, $.extend({
+ timeOnly: timeOnly,
+ onClose: function (dateText, inst) {
+ checkDates($(this), endTime);
+ },
+ onSelect: function (selectedDateTime) {
+ selected($(this), endTime, 'minDate');
+ }
+ }, options, options.start));
+ $.fn[method].call(endTime, $.extend({
+ timeOnly: timeOnly,
+ onClose: function (dateText, inst) {
+ checkDates($(this), startTime);
+ },
+ onSelect: function (selectedDateTime) {
+ selected($(this), startTime, 'maxDate');
+ }
+ }, options, options.end));
+
+ checkDates(startTime, endTime);
+
+ selected(startTime, endTime, 'minDate');
+ selected(endTime, startTime, 'maxDate');
+
+ return $([startTime.get(0), endTime.get(0)]);
+ };
+
+ /**
+ * Log error or data to the console during error or debugging
+ * @param {Object} err pass any type object to log to the console during error or debugging
+ * @return {void}
+ */
+ $.timepicker.log = function () {
+ // Older IE (9, maybe 10) throw error on accessing `window.console.log.apply`, so check first.
+ if (window.console && window.console.log && window.console.log.apply) {
+ window.console.log.apply(window.console, Array.prototype.slice.call(arguments));
+ }
+ };
+
+ /*
+ * Add util object to allow access to private methods for testability.
+ */
+ $.timepicker._util = {
+ _extendRemove: extendRemove,
+ _isEmptyObject: isEmptyObject,
+ _convert24to12: convert24to12,
+ _detectSupport: detectSupport,
+ _selectLocalTimezone: selectLocalTimezone,
+ _computeEffectiveSetting: computeEffectiveSetting,
+ _splitDateTime: splitDateTime,
+ _parseDateTimeInternal: parseDateTimeInternal
+ };
+
+ /*
+ * Microsecond support
+ */
+ if (!Date.prototype.getMicroseconds) {
+ Date.prototype.microseconds = 0;
+ Date.prototype.getMicroseconds = function () { return this.microseconds; };
+ Date.prototype.setMicroseconds = function (m) {
+ this.setMilliseconds(this.getMilliseconds() + Math.floor(m / 1000));
+ this.microseconds = m % 1000;
+ return this;
+ };
+ }
+
+ /*
+ * Keep up with the version
+ */
+ $.timepicker.version = "1.6.3";
+
+}));
diff --git a/dist/jquery-ui-timepicker-addon.min.css b/dist/jquery-ui-timepicker-addon.min.css
new file mode 100644
index 0000000..7581fea
--- /dev/null
+++ b/dist/jquery-ui-timepicker-addon.min.css
@@ -0,0 +1,5 @@
+/*! jQuery Timepicker Addon - v1.6.3 - 2016-04-20
+* http://trentrichardson.com/examples/timepicker
+* Copyright (c) 2016 Trent Richardson; Licensed MIT */
+
+.ui-timepicker-div .ui-widget-header{margin-bottom:8px}.ui-timepicker-div dl{text-align:left}.ui-timepicker-div dl dt{float:left;clear:left;padding:0 0 0 5px}.ui-timepicker-div dl dd{margin:0 10px 10px 40%}.ui-timepicker-div td{font-size:90%}.ui-tpicker-grid-label{background:0 0;border:0;margin:0;padding:0}.ui-timepicker-div .ui_tpicker_unit_hide{display:none}.ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input{background:0 0;color:inherit;border:0;outline:0;border-bottom:solid 1px #555;width:95%}.ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input:focus{border-bottom-color:#aaa}.ui-timepicker-rtl{direction:rtl}.ui-timepicker-rtl dl{text-align:right;padding:0 5px 0 0}.ui-timepicker-rtl dl dt{float:right;clear:right}.ui-timepicker-rtl dl dd{margin:0 40% 10px 10px}.ui-timepicker-div.ui-timepicker-oneLine{padding-right:2px}.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time,.ui-timepicker-div.ui-timepicker-oneLine dt{display:none}.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time_label{display:block;padding-top:2px}.ui-timepicker-div.ui-timepicker-oneLine dl{text-align:right}.ui-timepicker-div.ui-timepicker-oneLine dl dd,.ui-timepicker-div.ui-timepicker-oneLine dl dd>div{display:inline-block;margin:0}.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_minute:before,.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_second:before{content:':';display:inline-block}.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_millisec:before,.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_microsec:before{content:'.';display:inline-block}.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide,.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide:before{display:none}
\ No newline at end of file
diff --git a/dist/jquery-ui-timepicker-addon.min.js b/dist/jquery-ui-timepicker-addon.min.js
new file mode 100644
index 0000000..611cbd6
--- /dev/null
+++ b/dist/jquery-ui-timepicker-addon.min.js
@@ -0,0 +1,5 @@
+/*! jQuery Timepicker Addon - v1.6.3 - 2016-04-20
+* http://trentrichardson.com/examples/timepicker
+* Copyright (c) 2016 Trent Richardson; Licensed MIT */
+!function(a){"function"==typeof define&&define.amd?define(["jquery","jquery-ui"],a):a(jQuery)}(function($){if($.ui.timepicker=$.ui.timepicker||{},!$.ui.timepicker.version){$.extend($.ui,{timepicker:{version:"1.6.3"}});var Timepicker=function(){this.regional=[],this.regional[""]={currentText:"Now",closeText:"Done",amNames:["AM","A"],pmNames:["PM","P"],timeFormat:"HH:mm",timeSuffix:"",timeOnlyTitle:"Choose Time",timeText:"Time",hourText:"Hour",minuteText:"Minute",secondText:"Second",millisecText:"Millisecond",microsecText:"Microsecond",timezoneText:"Time Zone",isRTL:!1},this._defaults={showButtonPanel:!0,timeOnly:!1,timeOnlyShowDate:!1,showHour:null,showMinute:null,showSecond:null,showMillisec:null,showMicrosec:null,showTimezone:null,showTime:!0,stepHour:1,stepMinute:1,stepSecond:1,stepMillisec:1,stepMicrosec:1,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMin:0,minuteMin:0,secondMin:0,millisecMin:0,microsecMin:0,hourMax:23,minuteMax:59,secondMax:59,millisecMax:999,microsecMax:999,minDateTime:null,maxDateTime:null,maxTime:null,minTime:null,onSelect:null,hourGrid:0,minuteGrid:0,secondGrid:0,millisecGrid:0,microsecGrid:0,alwaysSetTime:!0,separator:" ",altFieldTimeOnly:!0,altTimeFormat:null,altSeparator:null,altTimeSuffix:null,altRedirectFocus:!0,pickerTimeFormat:null,pickerTimeSuffix:null,showTimepicker:!0,timezoneList:null,addSliderAccess:!1,sliderAccessArgs:null,controlType:"slider",oneLine:!1,defaultValue:null,parse:"strict",afterInject:null},$.extend(this._defaults,this.regional[""])};$.extend(Timepicker.prototype,{$input:null,$altInput:null,$timeObj:null,inst:null,hour_slider:null,minute_slider:null,second_slider:null,millisec_slider:null,microsec_slider:null,timezone_select:null,maxTime:null,minTime:null,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMinOriginal:null,minuteMinOriginal:null,secondMinOriginal:null,millisecMinOriginal:null,microsecMinOriginal:null,hourMaxOriginal:null,minuteMaxOriginal:null,secondMaxOriginal:null,millisecMaxOriginal:null,microsecMaxOriginal:null,ampm:"",formattedDate:"",formattedTime:"",formattedDateTime:"",timezoneList:null,units:["hour","minute","second","millisec","microsec"],support:{},control:null,setDefaults:function(a){return extendRemove(this._defaults,a||{}),this},_newInst:function($input,opts){var tp_inst=new Timepicker,inlineSettings={},fns={},overrides,i;for(var attrName in this._defaults)if(this._defaults.hasOwnProperty(attrName)){var attrValue=$input.attr("time:"+attrName);if(attrValue)try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}overrides={beforeShow:function(a,b){return $.isFunction(tp_inst._defaults.evnts.beforeShow)?tp_inst._defaults.evnts.beforeShow.call($input[0],a,b,tp_inst):void 0},onChangeMonthYear:function(a,b,c){$.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)&&tp_inst._defaults.evnts.onChangeMonthYear.call($input[0],a,b,c,tp_inst)},onClose:function(a,b){tp_inst.timeDefined===!0&&""!==$input.val()&&tp_inst._updateDateTime(b),$.isFunction(tp_inst._defaults.evnts.onClose)&&tp_inst._defaults.evnts.onClose.call($input[0],a,b,tp_inst)}};for(i in overrides)overrides.hasOwnProperty(i)&&(fns[i]=opts[i]||this._defaults[i]||null);tp_inst._defaults=$.extend({},this._defaults,inlineSettings,opts,overrides,{evnts:fns,timepicker:tp_inst}),tp_inst.amNames=$.map(tp_inst._defaults.amNames,function(a){return a.toUpperCase()}),tp_inst.pmNames=$.map(tp_inst._defaults.pmNames,function(a){return a.toUpperCase()}),tp_inst.support=detectSupport(tp_inst._defaults.timeFormat+(tp_inst._defaults.pickerTimeFormat?tp_inst._defaults.pickerTimeFormat:"")+(tp_inst._defaults.altTimeFormat?tp_inst._defaults.altTimeFormat:"")),"string"==typeof tp_inst._defaults.controlType?("slider"===tp_inst._defaults.controlType&&"undefined"==typeof $.ui.slider&&(tp_inst._defaults.controlType="select"),tp_inst.control=tp_inst._controls[tp_inst._defaults.controlType]):tp_inst.control=tp_inst._defaults.controlType;var timezoneList=[-720,-660,-600,-570,-540,-480,-420,-360,-300,-270,-240,-210,-180,-120,-60,0,60,120,180,210,240,270,300,330,345,360,390,420,480,525,540,570,600,630,660,690,720,765,780,840];null!==tp_inst._defaults.timezoneList&&(timezoneList=tp_inst._defaults.timezoneList);var tzl=timezoneList.length,tzi=0,tzv=null;if(tzl>0&&"object"!=typeof timezoneList[0])for(;tzl>tzi;tzi++)tzv=timezoneList[tzi],timezoneList[tzi]={value:tzv,label:$.timepicker.timezoneOffsetString(tzv,tp_inst.support.iso8601)};return tp_inst._defaults.timezoneList=timezoneList,tp_inst.timezone=null!==tp_inst._defaults.timezone?$.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone):-1*(new Date).getTimezoneOffset(),tp_inst.hour=tp_inst._defaults.hourtp_inst._defaults.hourMax?tp_inst._defaults.hourMax:tp_inst._defaults.hour,tp_inst.minute=tp_inst._defaults.minutetp_inst._defaults.minuteMax?tp_inst._defaults.minuteMax:tp_inst._defaults.minute,tp_inst.second=tp_inst._defaults.secondtp_inst._defaults.secondMax?tp_inst._defaults.secondMax:tp_inst._defaults.second,tp_inst.millisec=tp_inst._defaults.millisectp_inst._defaults.millisecMax?tp_inst._defaults.millisecMax:tp_inst._defaults.millisec,tp_inst.microsec=tp_inst._defaults.microsectp_inst._defaults.microsecMax?tp_inst._defaults.microsecMax:tp_inst._defaults.microsec,tp_inst.ampm="",tp_inst.$input=$input,tp_inst._defaults.altField&&(tp_inst.$altInput=$(tp_inst._defaults.altField),tp_inst._defaults.altRedirectFocus===!0&&tp_inst.$altInput.css({cursor:"pointer"}).focus(function(){$input.trigger("focus")})),(0===tp_inst._defaults.minDate||0===tp_inst._defaults.minDateTime)&&(tp_inst._defaults.minDate=new Date),(0===tp_inst._defaults.maxDate||0===tp_inst._defaults.maxDateTime)&&(tp_inst._defaults.maxDate=new Date),void 0!==tp_inst._defaults.minDate&&tp_inst._defaults.minDate instanceof Date&&(tp_inst._defaults.minDateTime=new Date(tp_inst._defaults.minDate.getTime())),void 0!==tp_inst._defaults.minDateTime&&tp_inst._defaults.minDateTime instanceof Date&&(tp_inst._defaults.minDate=new Date(tp_inst._defaults.minDateTime.getTime())),void 0!==tp_inst._defaults.maxDate&&tp_inst._defaults.maxDate instanceof Date&&(tp_inst._defaults.maxDateTime=new Date(tp_inst._defaults.maxDate.getTime())),void 0!==tp_inst._defaults.maxDateTime&&tp_inst._defaults.maxDateTime instanceof Date&&(tp_inst._defaults.maxDate=new Date(tp_inst._defaults.maxDateTime.getTime())),tp_inst.$input.bind("focus",function(){tp_inst._onFocus()}),tp_inst},_addTimePicker:function(a){var b=$.trim(this.$altInput&&this._defaults.altFieldTimeOnly?this.$input.val()+" "+this.$altInput.val():this.$input.val());this.timeDefined=this._parseTime(b),this._limitMinMaxDateTime(a,!1),this._injectTimePicker(),this._afterInject()},_parseTime:function(a,b){if(this.inst||(this.inst=$.datepicker._getInst(this.$input[0])),b||!this._defaults.timeOnly){var c=$.datepicker._get(this.inst,"dateFormat");try{var d=parseDateTimeInternal(c,this._defaults.timeFormat,a,$.datepicker._getFormatConfig(this.inst),this._defaults);if(!d.timeObj)return!1;$.extend(this,d.timeObj)}catch(e){return $.timepicker.log("Error parsing the date/time string: "+e+"\ndate/time string = "+a+"\ntimeFormat = "+this._defaults.timeFormat+"\ndateFormat = "+c),!1}return!0}var f=$.datepicker.parseTime(this._defaults.timeFormat,a,this._defaults);return f?($.extend(this,f),!0):!1},_afterInject:function(){var a=this.inst.settings;$.isFunction(a.afterInject)&&a.afterInject.call(this)},_injectTimePicker:function(){var a=this.inst.dpDiv,b=this.inst.settings,c=this,d="",e="",f=null,g={},h={},i=null,j=0,k=0;if(0===a.find("div.ui-timepicker-div").length&&b.showTimepicker){var l=" ui_tpicker_unit_hide",m=''+b.timeText+' ";for(j=0,k=this.units.length;k>j;j++){if(d=this.units[j],e=d.substr(0,1).toUpperCase()+d.substr(1),f=null!==b["show"+e]?b["show"+e]:this.support[d],g[d]=parseInt(b[d+"Max"]-(b[d+"Max"]-b[d+"Min"])%b["step"+e],10),h[d]=0,m+=''+b[d+"Text"]+'
',f&&b[d+"Grid"]>0){if(m+='',"hour"===d)for(var n=b[d+"Min"];n<=g[d];n+=parseInt(b[d+"Grid"],10)){h[d]++;var o=$.datepicker.formatTime(this.support.ampm?"hht":"HH",{hour:n},b);m+=''+o+" "}else for(var p=b[d+"Min"];p<=g[d];p+=parseInt(b[d+"Grid"],10))h[d]++,m+=''+(10>p?"0":"")+p+" ";m+="
"}m+=" "}var q=null!==b.showTimezone?b.showTimezone:this.support.timezone;m+=''+b.timezoneText+" ",m+=' ',m+=" ";var r=$(m);for(b.timeOnly===!0&&(r.prepend('"),a.find(".ui-datepicker-header, .ui-datepicker-calendar").hide()),j=0,k=c.units.length;k>j;j++)d=c.units[j],e=d.substr(0,1).toUpperCase()+d.substr(1),f=null!==b["show"+e]?b["show"+e]:this.support[d],c[d+"_slider"]=c.control.create(c,r.find(".ui_tpicker_"+d+"_slider"),d,c[d],b[d+"Min"],g[d],b["step"+e]),f&&b[d+"Grid"]>0&&(i=100*h[d]*b[d+"Grid"]/(g[d]-b[d+"Min"]),r.find(".ui_tpicker_"+d+" table").css({width:i+"%",marginLeft:b.isRTL?"0":i/(-2*h[d])+"%",marginRight:b.isRTL?i/(-2*h[d])+"%":"0",borderCollapse:"collapse"}).find("td").click(function(a){var b=$(this),e=b.html(),f=parseInt(e.replace(/[^0-9]/g),10),g=e.replace(/[^apm]/gi),h=b.data("for");"hour"===h&&(-1!==g.indexOf("p")&&12>f?f+=12:-1!==g.indexOf("a")&&12===f&&(f=0)),c.control.value(c,c[h+"_slider"],d,f),c._onTimeChange(),c._onSelectHandler()}).css({cursor:"pointer",width:100/h[d]+"%",textAlign:"center",overflow:"hidden"}));if(this.timezone_select=r.find(".ui_tpicker_timezone").append(" ").find("select"),$.fn.append.apply(this.timezone_select,$.map(b.timezoneList,function(a,b){return $(" ").val("object"==typeof a?a.value:a).text("object"==typeof a?a.label:a)})),"undefined"!=typeof this.timezone&&null!==this.timezone&&""!==this.timezone){var s=-1*new Date(this.inst.selectedYear,this.inst.selectedMonth,this.inst.selectedDay,12).getTimezoneOffset();s===this.timezone?selectLocalTimezone(c):this.timezone_select.val(this.timezone)}else"undefined"!=typeof this.hour&&null!==this.hour&&""!==this.hour?this.timezone_select.val(b.timezone):selectLocalTimezone(c);this.timezone_select.change(function(){c._onTimeChange(),c._onSelectHandler(),c._afterInject()});var t=a.find(".ui-datepicker-buttonpane");if(t.length?t.before(r):a.append(r),this.$timeObj=r.find(".ui_tpicker_time_input"),this.$timeObj.change(function(){var a=c.inst.settings.timeFormat,b=$.datepicker.parseTime(a,this.value),d=new Date;b?(d.setHours(b.hour),d.setMinutes(b.minute),d.setSeconds(b.second),$.datepicker._setTime(c.inst,d)):(this.value=c.formattedTime,this.blur())}),null!==this.inst){var u=this.timeDefined;this._onTimeChange(),this.timeDefined=u}if(this._defaults.addSliderAccess){var v=this._defaults.sliderAccessArgs,w=this._defaults.isRTL;v.isRTL=w,setTimeout(function(){if(0===r.find(".ui-slider-access").length){r.find(".ui-slider:visible").sliderAccess(v);var a=r.find(".ui-slider-access:eq(0)").outerWidth(!0);a&&r.find("table:visible").each(function(){var b=$(this),c=b.outerWidth(),d=b.css(w?"marginRight":"marginLeft").toString().replace("%",""),e=c-a,f=d*e/c+"%",g={width:e,marginRight:0,marginLeft:0};g[w?"marginRight":"marginLeft"]=f,b.css(g)})}},10)}c._limitMinMaxDateTime(this.inst,!0)}},_limitMinMaxDateTime:function(a,b){var c=this._defaults,d=new Date(a.selectedYear,a.selectedMonth,a.selectedDay);if(this._defaults.showTimepicker){if(null!==$.datepicker._get(a,"minDateTime")&&void 0!==$.datepicker._get(a,"minDateTime")&&d){var e=$.datepicker._get(a,"minDateTime"),f=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0,0);(null===this.hourMinOriginal||null===this.minuteMinOriginal||null===this.secondMinOriginal||null===this.millisecMinOriginal||null===this.microsecMinOriginal)&&(this.hourMinOriginal=c.hourMin,this.minuteMinOriginal=c.minuteMin,this.secondMinOriginal=c.secondMin,this.millisecMinOriginal=c.millisecMin,this.microsecMinOriginal=c.microsecMin),a.settings.timeOnly||f.getTime()===d.getTime()?(this._defaults.hourMin=e.getHours(),this.hour<=this._defaults.hourMin?(this.hour=this._defaults.hourMin,this._defaults.minuteMin=e.getMinutes(),this.minute<=this._defaults.minuteMin?(this.minute=this._defaults.minuteMin,this._defaults.secondMin=e.getSeconds(),this.second<=this._defaults.secondMin?(this.second=this._defaults.secondMin,this._defaults.millisecMin=e.getMilliseconds(),this.millisec<=this._defaults.millisecMin?(this.millisec=this._defaults.millisecMin,this._defaults.microsecMin=e.getMicroseconds()):(this.microsec=this._defaults.hourMax?(this.hour=this._defaults.hourMax,this._defaults.minuteMax=g.getMinutes(),this.minute>=this._defaults.minuteMax?(this.minute=this._defaults.minuteMax,this._defaults.secondMax=g.getSeconds(),this.second>=this._defaults.secondMax?(this.second=this._defaults.secondMax,this._defaults.millisecMax=g.getMilliseconds(),this.millisec>=this._defaults.millisecMax?(this.millisec=this._defaults.millisecMax,this._defaults.microsecMax=g.getMicroseconds()):(this.microsec>this._defaults.microsecMax&&(this.microsec=this._defaults.microsecMax),this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.hourMax=this.hourMaxOriginal,this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)}if(null!==a.settings.minTime){var i=new Date("01/01/1970 "+a.settings.minTime);this.hourj.getHours()?(this.hour=this._defaults.hourMax=j.getHours(),this.minute=this._defaults.minuteMax=j.getMinutes()):this.hour===j.getHours()&&this.minute>j.getMinutes()?this.minute=this._defaults.minuteMax=j.getMinutes():this._defaults.hourMax>j.getHours()?(this._defaults.hourMax=j.getHours(),this._defaults.minuteMax=j.getMinutes()):this._defaults.hourMax===j.getHours()===this.hour&&this._defaults.minuteMax>j.getMinutes()?this._defaults.minuteMax=j.getMinutes():this._defaults.minuteMax=59}if(void 0!==b&&b===!0){var k=parseInt(this._defaults.hourMax-(this._defaults.hourMax-this._defaults.hourMin)%this._defaults.stepHour,10),l=parseInt(this._defaults.minuteMax-(this._defaults.minuteMax-this._defaults.minuteMin)%this._defaults.stepMinute,10),m=parseInt(this._defaults.secondMax-(this._defaults.secondMax-this._defaults.secondMin)%this._defaults.stepSecond,10),n=parseInt(this._defaults.millisecMax-(this._defaults.millisecMax-this._defaults.millisecMin)%this._defaults.stepMillisec,10),o=parseInt(this._defaults.microsecMax-(this._defaults.microsecMax-this._defaults.microsecMin)%this._defaults.stepMicrosec,10);this.hour_slider&&(this.control.options(this,this.hour_slider,"hour",{min:this._defaults.hourMin,max:k,step:this._defaults.stepHour}),this.control.value(this,this.hour_slider,"hour",this.hour-this.hour%this._defaults.stepHour)),this.minute_slider&&(this.control.options(this,this.minute_slider,"minute",{min:this._defaults.minuteMin,max:l,step:this._defaults.stepMinute}),this.control.value(this,this.minute_slider,"minute",this.minute-this.minute%this._defaults.stepMinute)),this.second_slider&&(this.control.options(this,this.second_slider,"second",{min:this._defaults.secondMin,max:m,step:this._defaults.stepSecond}),this.control.value(this,this.second_slider,"second",this.second-this.second%this._defaults.stepSecond)),this.millisec_slider&&(this.control.options(this,this.millisec_slider,"millisec",{min:this._defaults.millisecMin,max:n,step:this._defaults.stepMillisec}),this.control.value(this,this.millisec_slider,"millisec",this.millisec-this.millisec%this._defaults.stepMillisec)),this.microsec_slider&&(this.control.options(this,this.microsec_slider,"microsec",{min:this._defaults.microsecMin,max:o,step:this._defaults.stepMicrosec}),this.control.value(this,this.microsec_slider,"microsec",this.microsec-this.microsec%this._defaults.stepMicrosec))}}},_onTimeChange:function(){if(this._defaults.showTimepicker){var a=this.hour_slider?this.control.value(this,this.hour_slider,"hour"):!1,b=this.minute_slider?this.control.value(this,this.minute_slider,"minute"):!1,c=this.second_slider?this.control.value(this,this.second_slider,"second"):!1,d=this.millisec_slider?this.control.value(this,this.millisec_slider,"millisec"):!1,e=this.microsec_slider?this.control.value(this,this.microsec_slider,"microsec"):!1,f=this.timezone_select?this.timezone_select.val():!1,g=this._defaults,h=g.pickerTimeFormat||g.timeFormat,i=g.pickerTimeSuffix||g.timeSuffix;"object"==typeof a&&(a=!1),"object"==typeof b&&(b=!1),"object"==typeof c&&(c=!1),"object"==typeof d&&(d=!1),"object"==typeof e&&(e=!1),"object"==typeof f&&(f=!1),a!==!1&&(a=parseInt(a,10)),b!==!1&&(b=parseInt(b,10)),c!==!1&&(c=parseInt(c,10)),d!==!1&&(d=parseInt(d,10)),e!==!1&&(e=parseInt(e,10)),f!==!1&&(f=f.toString());var j=g[12>a?"amNames":"pmNames"][0],k=a!==parseInt(this.hour,10)||b!==parseInt(this.minute,10)||c!==parseInt(this.second,10)||d!==parseInt(this.millisec,10)||e!==parseInt(this.microsec,10)||this.ampm.length>0&&12>a!=(-1!==$.inArray(this.ampm.toUpperCase(),this.amNames))||null!==this.timezone&&f!==this.timezone.toString();if(k&&(a!==!1&&(this.hour=a),b!==!1&&(this.minute=b),c!==!1&&(this.second=c),d!==!1&&(this.millisec=d),e!==!1&&(this.microsec=e),f!==!1&&(this.timezone=f),this.inst||(this.inst=$.datepicker._getInst(this.$input[0])),this._limitMinMaxDateTime(this.inst,!0)),this.support.ampm&&(this.ampm=j),this.formattedTime=$.datepicker.formatTime(g.timeFormat,this,g),this.$timeObj&&(this.$timeObj.val(h===g.timeFormat?this.formattedTime+i:$.datepicker.formatTime(h,this,g)+i),this.$timeObj[0].setSelectionRange)){var l=this.$timeObj[0].selectionStart,m=this.$timeObj[0].selectionEnd;this.$timeObj[0].setSelectionRange(l,m)}this.timeDefined=!0,k&&this._updateDateTime()}},_onSelectHandler:function(){var a=this._defaults.onSelect||this.inst.settings.onSelect,b=this.$input?this.$input[0]:null;a&&b&&a.apply(b,[this.formattedDateTime,this])},_updateDateTime:function(a){a=this.inst||a;var b=a.currentYear>0?new Date(a.currentYear,a.currentMonth,a.currentDay):new Date(a.selectedYear,a.selectedMonth,a.selectedDay),c=$.datepicker._daylightSavingAdjust(b),d=$.datepicker._get(a,"dateFormat"),e=$.datepicker._getFormatConfig(a),f=null!==c&&this.timeDefined;this.formattedDate=$.datepicker.formatDate(d,null===c?new Date:c,e);var g=this.formattedDate;if(""===a.lastVal&&(a.currentYear=a.selectedYear,a.currentMonth=a.selectedMonth,a.currentDay=a.selectedDay),this._defaults.timeOnly===!0&&this._defaults.timeOnlyShowDate===!1?g=this.formattedTime:(this._defaults.timeOnly!==!0&&(this._defaults.alwaysSetTime||f)||this._defaults.timeOnly===!0&&this._defaults.timeOnlyShowDate===!0)&&(g+=this._defaults.separator+this.formattedTime+this._defaults.timeSuffix),this.formattedDateTime=g,this._defaults.showTimepicker)if(this.$altInput&&this._defaults.timeOnly===!1&&this._defaults.altFieldTimeOnly===!0)this.$altInput.val(this.formattedTime),this.$input.val(this.formattedDate);else if(this.$altInput){this.$input.val(g);var h="",i=null!==this._defaults.altSeparator?this._defaults.altSeparator:this._defaults.separator,j=null!==this._defaults.altTimeSuffix?this._defaults.altTimeSuffix:this._defaults.timeSuffix;this._defaults.timeOnly||(h=this._defaults.altFormat?$.datepicker.formatDate(this._defaults.altFormat,null===c?new Date:c,e):this.formattedDate,h&&(h+=i)),h+=null!==this._defaults.altTimeFormat?$.datepicker.formatTime(this._defaults.altTimeFormat,this,this._defaults)+j:this.formattedTime+j,this.$altInput.val(h)}else this.$input.val(g);else this.$input.val(this.formattedDate);this.$input.trigger("change")},_onFocus:function(){if(!this.$input.val()&&this._defaults.defaultValue){this.$input.val(this._defaults.defaultValue);var a=$.datepicker._getInst(this.$input.get(0)),b=$.datepicker._get(a,"timepicker");if(b&&b._defaults.timeOnly&&a.input.val()!==a.lastVal)try{$.datepicker._updateDatepicker(a)}catch(c){$.timepicker.log(c)}}},_controls:{slider:{create:function(a,b,c,d,e,f,g){var h=a._defaults.isRTL;return b.prop("slide",null).slider({orientation:"horizontal",value:h?-1*d:d,min:h?-1*f:e,max:h?-1*e:f,step:g,slide:function(b,d){a.control.value(a,$(this),c,h?-1*d.value:d.value),a._onTimeChange()},stop:function(b,c){a._onSelectHandler()}})},options:function(a,b,c,d,e){if(a._defaults.isRTL){if("string"==typeof d)return"min"===d||"max"===d?void 0!==e?b.slider(d,-1*e):Math.abs(b.slider(d)):b.slider(d);var f=d.min,g=d.max;return d.min=d.max=null,void 0!==f&&(d.max=-1*f),void 0!==g&&(d.min=-1*g),b.slider(d)}return"string"==typeof d&&void 0!==e?b.slider(d,e):b.slider(d)},value:function(a,b,c,d){return a._defaults.isRTL?void 0!==d?b.slider("value",-1*d):Math.abs(b.slider("value")):void 0!==d?b.slider("value",d):b.slider("value")}},select:{create:function(a,b,c,d,e,f,g){for(var h='',i=a._defaults.pickerTimeFormat||a._defaults.timeFormat,j=e;f>=j;j+=g)h+='",h+="hour"===c?$.datepicker.formatTime($.trim(i.replace(/[^ht ]/gi,"")),{hour:j},a._defaults):"millisec"===c||"microsec"===c||j>=10?j:"0"+j.toString(),h+=" ";return h+=" ",b.children("select").remove(),$(h).appendTo(b).change(function(b){a._onTimeChange(),a._onSelectHandler(),a._afterInject()}),b},options:function(a,b,c,d,e){var f={},g=b.children("select");if("string"==typeof d){if(void 0===e)return g.data(d);f[d]=e}else f=d;return a.control.create(a,b,g.data("unit"),g.val(),f.min>=0?f.min:g.data("min"),f.max||g.data("max"),f.step||g.data("step"))},value:function(a,b,c,d){var e=b.children("select");return void 0!==d?e.val(d):e.val()}}}}),$.fn.extend({timepicker:function(a){a=a||{};var b=Array.prototype.slice.call(arguments);return"object"==typeof a&&(b[0]=$.extend(a,{timeOnly:!0})),$(this).each(function(){$.fn.datetimepicker.apply($(this),b)})},datetimepicker:function(a){a=a||{};var b=arguments;return"string"==typeof a?"getDate"===a||"option"===a&&2===b.length&&"string"==typeof b[1]?$.fn.datepicker.apply($(this[0]),b):this.each(function(){var a=$(this);a.datepicker.apply(a,b)}):this.each(function(){var b=$(this);b.datepicker($.timepicker._newInst(b,a)._defaults)})}}),$.datepicker.parseDateTime=function(a,b,c,d,e){var f=parseDateTimeInternal(a,b,c,d,e);if(f.timeObj){var g=f.timeObj;f.date.setHours(g.hour,g.minute,g.second,g.millisec),f.date.setMicroseconds(g.microsec)}return f.date},$.datepicker.parseTime=function(a,b,c){var d=extendRemove(extendRemove({},$.timepicker._defaults),c||{}),e=(-1!==a.replace(/\'.*?\'/g,"").indexOf("Z"),function(a,b,c){var d,e=function(a,b){var c=[];return a&&$.merge(c,a),b&&$.merge(c,b),c=$.map(c,function(a){return a.replace(/[.*+?|()\[\]{}\\]/g,"\\$&")}),"("+c.join("|")+")?"},f=function(a){var b=a.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),c={h:-1,m:-1,s:-1,l:-1,c:-1,t:-1,z:-1};if(b)for(var d=0;d 11&&(e=c.pmNames[0]),d=d.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g,function(a){switch(a){case"HH":return("0"+f).slice(-2);case"H":return f;case"hh":return("0"+convert24to12(f)).slice(-2);case"h":return convert24to12(f);case"mm":return("0"+b.minute).slice(-2);case"m":return b.minute;case"ss":return("0"+b.second).slice(-2);case"s":return b.second;case"l":return("00"+b.millisec).slice(-3);case"c":return("00"+b.microsec).slice(-3);case"z":return $.timepicker.timezoneOffsetString(null===b.timezone?c.timezone:b.timezone,!1);case"Z":return $.timepicker.timezoneOffsetString(null===b.timezone?c.timezone:b.timezone,!0);case"T":return e.charAt(0).toUpperCase();case"TT":return e.toUpperCase();case"t":return e.charAt(0).toLowerCase();case"tt":return e.toLowerCase();default:return a.replace(/'/g,"")}})},$.datepicker._base_selectDate=$.datepicker._selectDate,$.datepicker._selectDate=function(a,b){var c,d=this._getInst($(a)[0]),e=this._get(d,"timepicker");e&&d.settings.showTimepicker?(e._limitMinMaxDateTime(d,!0),c=d.inline,d.inline=d.stay_open=!0,this._base_selectDate(a,b),d.inline=c,d.stay_open=!1,this._notifyChange(d),this._updateDatepicker(d)):this._base_selectDate(a,b)},$.datepicker._base_updateDatepicker=$.datepicker._updateDatepicker,$.datepicker._updateDatepicker=function(a){var b=a.input[0];if(!($.datepicker._curInst&&$.datepicker._curInst!==a&&$.datepicker._datepickerShowing&&$.datepicker._lastInput!==b||"boolean"==typeof a.stay_open&&a.stay_open!==!1)){this._base_updateDatepicker(a);var c=this._get(a,"timepicker");c&&c._addTimePicker(a)}},$.datepicker._base_doKeyPress=$.datepicker._doKeyPress,$.datepicker._doKeyPress=function(a){var b=$.datepicker._getInst(a.target),c=$.datepicker._get(b,"timepicker");if(c&&$.datepicker._get(b,"constrainInput")){var d=c.support.ampm,e=null!==c._defaults.showTimezone?c._defaults.showTimezone:c.support.timezone,f=$.datepicker._possibleChars($.datepicker._get(b,"dateFormat")),g=c._defaults.timeFormat.toString().replace(/[hms]/g,"").replace(/TT/g,d?"APM":"").replace(/Tt/g,d?"AaPpMm":"").replace(/tT/g,d?"AaPpMm":"").replace(/T/g,d?"AP":"").replace(/tt/g,d?"apm":"").replace(/t/g,d?"ap":"")+" "+c._defaults.separator+c._defaults.timeSuffix+(e?c._defaults.timezoneList.join(""):"")+c._defaults.amNames.join("")+c._defaults.pmNames.join("")+f,h=String.fromCharCode(void 0===a.charCode?a.keyCode:a.charCode);return a.ctrlKey||" ">h||!f||g.indexOf(h)>-1}return $.datepicker._base_doKeyPress(a)},$.datepicker._base_updateAlternate=$.datepicker._updateAlternate,$.datepicker._updateAlternate=function(a){var b=this._get(a,"timepicker");if(b){var c=b._defaults.altField;if(c){var d=(b._defaults.altFormat||b._defaults.dateFormat,this._getDate(a)),e=$.datepicker._getFormatConfig(a),f="",g=b._defaults.altSeparator?b._defaults.altSeparator:b._defaults.separator,h=b._defaults.altTimeSuffix?b._defaults.altTimeSuffix:b._defaults.timeSuffix,i=null!==b._defaults.altTimeFormat?b._defaults.altTimeFormat:b._defaults.timeFormat;f+=$.datepicker.formatTime(i,b,b._defaults)+h,b._defaults.timeOnly||b._defaults.altFieldTimeOnly||null===d||(f=b._defaults.altFormat?$.datepicker.formatDate(b._defaults.altFormat,d,e)+g+f:b.formattedDate+g+f),$(c).val(a.input.val()?f:"")}}else $.datepicker._base_updateAlternate(a)},$.datepicker._base_doKeyUp=$.datepicker._doKeyUp,$.datepicker._doKeyUp=function(a){var b=$.datepicker._getInst(a.target),c=$.datepicker._get(b,"timepicker");
+if(c&&c._defaults.timeOnly&&b.input.val()!==b.lastVal)try{$.datepicker._updateDatepicker(b)}catch(d){$.timepicker.log(d)}return $.datepicker._base_doKeyUp(a)},$.datepicker._base_gotoToday=$.datepicker._gotoToday,$.datepicker._gotoToday=function(a){var b=this._getInst($(a)[0]);this._base_gotoToday(a);var c=this._get(b,"timepicker");if(c){var d=$.timepicker.timezoneOffsetNumber(c.timezone),e=new Date;e.setMinutes(e.getMinutes()+e.getTimezoneOffset()+parseInt(d,10)),this._setTime(b,e),this._setDate(b,e),c._onSelectHandler()}},$.datepicker._disableTimepickerDatepicker=function(a){var b=this._getInst(a);if(b){var c=this._get(b,"timepicker");$(a).datepicker("getDate"),c&&(b.settings.showTimepicker=!1,c._defaults.showTimepicker=!1,c._updateDateTime(b))}},$.datepicker._enableTimepickerDatepicker=function(a){var b=this._getInst(a);if(b){var c=this._get(b,"timepicker");$(a).datepicker("getDate"),c&&(b.settings.showTimepicker=!0,c._defaults.showTimepicker=!0,c._addTimePicker(b),c._updateDateTime(b))}},$.datepicker._setTime=function(a,b){var c=this._get(a,"timepicker");if(c){var d=c._defaults;c.hour=b?b.getHours():d.hour,c.minute=b?b.getMinutes():d.minute,c.second=b?b.getSeconds():d.second,c.millisec=b?b.getMilliseconds():d.millisec,c.microsec=b?b.getMicroseconds():d.microsec,c._limitMinMaxDateTime(a,!0),c._onTimeChange(),c._updateDateTime(a)}},$.datepicker._setTimeDatepicker=function(a,b,c){var d=this._getInst(a);if(d){var e=this._get(d,"timepicker");if(e){this._setDateFromField(d);var f;b&&("string"==typeof b?(e._parseTime(b,c),f=new Date,f.setHours(e.hour,e.minute,e.second,e.millisec),f.setMicroseconds(e.microsec)):(f=new Date(b.getTime()),f.setMicroseconds(b.getMicroseconds())),"Invalid Date"===f.toString()&&(f=void 0),this._setTime(d,f))}}},$.datepicker._base_setDateDatepicker=$.datepicker._setDateDatepicker,$.datepicker._setDateDatepicker=function(a,b){var c=this._getInst(a),d=b;if(c){"string"==typeof b&&(d=new Date(b),d.getTime()||(this._base_setDateDatepicker.apply(this,arguments),d=$(a).datepicker("getDate")));var e,f=this._get(c,"timepicker");d instanceof Date?(e=new Date(d.getTime()),e.setMicroseconds(d.getMicroseconds())):e=d,f&&e&&(f.support.timezone||null!==f._defaults.timezone||(f.timezone=-1*e.getTimezoneOffset()),d=$.timepicker.timezoneAdjust(d,$.timepicker.timezoneOffsetString(-d.getTimezoneOffset()),f.timezone),e=$.timepicker.timezoneAdjust(e,$.timepicker.timezoneOffsetString(-e.getTimezoneOffset()),f.timezone)),this._updateDatepicker(c),this._base_setDateDatepicker.apply(this,arguments),this._setTimeDatepicker(a,e,!0)}},$.datepicker._base_getDateDatepicker=$.datepicker._getDateDatepicker,$.datepicker._getDateDatepicker=function(a,b){var c=this._getInst(a);if(c){var d=this._get(c,"timepicker");if(d){void 0===c.lastVal&&this._setDateFromField(c,b);var e=this._getDate(c),f=null;return f=d.$altInput&&d._defaults.altFieldTimeOnly?d.$input.val()+" "+d.$altInput.val():"INPUT"!==d.$input.get(0).tagName&&d.$altInput?d.$altInput.val():d.$input.val(),e&&d._parseTime(f,!c.settings.timeOnly)&&(e.setHours(d.hour,d.minute,d.second,d.millisec),e.setMicroseconds(d.microsec),null!=d.timezone&&(d.support.timezone||null!==d._defaults.timezone||(d.timezone=-1*e.getTimezoneOffset()),e=$.timepicker.timezoneAdjust(e,d.timezone,$.timepicker.timezoneOffsetString(-e.getTimezoneOffset())))),e}return this._base_getDateDatepicker(a,b)}},$.datepicker._base_parseDate=$.datepicker.parseDate,$.datepicker.parseDate=function(a,b,c){var d;try{d=this._base_parseDate(a,b,c)}catch(e){if(!(e.indexOf(":")>=0))throw e;d=this._base_parseDate(a,b.substring(0,b.length-(e.length-e.indexOf(":")-2)),c),$.timepicker.log("Error parsing the date string: "+e+"\ndate string = "+b+"\ndate format = "+a)}return d},$.datepicker._base_formatDate=$.datepicker._formatDate,$.datepicker._formatDate=function(a,b,c,d){var e=this._get(a,"timepicker");return e?(e._updateDateTime(a),e.$input.val()):this._base_formatDate(a)},$.datepicker._base_optionDatepicker=$.datepicker._optionDatepicker,$.datepicker._optionDatepicker=function(a,b,c){var d,e=this._getInst(a);if(!e)return null;var f=this._get(e,"timepicker");if(f){var g,h,i,j,k=null,l=null,m=null,n=f._defaults.evnts,o={};if("string"==typeof b){if("minDate"===b||"minDateTime"===b)k=c;else if("maxDate"===b||"maxDateTime"===b)l=c;else if("onSelect"===b)m=c;else if(n.hasOwnProperty(b)){if("undefined"==typeof c)return n[b];o[b]=c,d={}}}else if("object"==typeof b){b.minDate?k=b.minDate:b.minDateTime?k=b.minDateTime:b.maxDate?l=b.maxDate:b.maxDateTime&&(l=b.maxDateTime);for(g in n)n.hasOwnProperty(g)&&b[g]&&(o[g]=b[g])}for(g in o)o.hasOwnProperty(g)&&(n[g]=o[g],d||(d=$.extend({},b)),delete d[g]);if(d&&isEmptyObject(d))return;if(k?(k=0===k?new Date:new Date(k),f._defaults.minDate=k,f._defaults.minDateTime=k):l?(l=0===l?new Date:new Date(l),f._defaults.maxDate=l,f._defaults.maxDateTime=l):m&&(f._defaults.onSelect=m),k||l)return j=$(a),i=j.datetimepicker("getDate"),h=this._base_optionDatepicker.call($.datepicker,a,d||b,c),j.datetimepicker("setDate",i),h}return void 0===c?this._base_optionDatepicker.call($.datepicker,a,b):this._base_optionDatepicker.call($.datepicker,a,d||b,c)};var isEmptyObject=function(a){var b;for(b in a)if(a.hasOwnProperty(b))return!1;return!0},extendRemove=function(a,b){$.extend(a,b);for(var c in b)(null===b[c]||void 0===b[c])&&(a[c]=b[c]);return a},detectSupport=function(a){var b=a.replace(/'.*?'/g,"").toLowerCase(),c=function(a,b){return-1!==a.indexOf(b)?!0:!1};return{hour:c(b,"h"),minute:c(b,"m"),second:c(b,"s"),millisec:c(b,"l"),microsec:c(b,"c"),timezone:c(b,"z"),ampm:c(b,"t")&&c(a,"h"),iso8601:c(a,"Z")}},convert24to12=function(a){return a%=12,0===a&&(a=12),String(a)},computeEffectiveSetting=function(a,b){return a&&a[b]?a[b]:$.timepicker._defaults[b]},splitDateTime=function(a,b){var c=computeEffectiveSetting(b,"separator"),d=computeEffectiveSetting(b,"timeFormat"),e=d.split(c),f=e.length,g=a.split(c),h=g.length;return h>1?{dateString:g.splice(0,h-f).join(c),timeString:g.splice(0,f).join(c)}:{dateString:a,timeString:""}},parseDateTimeInternal=function(a,b,c,d,e){var f,g,h;if(g=splitDateTime(c,e),f=$.datepicker._base_parseDate(a,g.dateString,d),""===g.timeString)return{date:f};if(h=$.datepicker.parseTime(b,g.timeString,e),!h)throw"Wrong time format";return{date:f,timeObj:h}},selectLocalTimezone=function(a,b){if(a&&a.timezone_select){var c=b||new Date;a.timezone_select.val(-c.getTimezoneOffset())}};$.timepicker=new Timepicker,$.timepicker.timezoneOffsetString=function(a,b){if(isNaN(a)||a>840||-720>a)return a;var c=a,d=c%60,e=(c-d)/60,f=b?":":"",g=(c>=0?"+":"-")+("0"+Math.abs(e)).slice(-2)+f+("0"+Math.abs(d)).slice(-2);return"+00:00"===g?"Z":g},$.timepicker.timezoneOffsetNumber=function(a){var b=a.toString().replace(":","");return"Z"===b.toUpperCase()?0:/^(\-|\+)\d{4}$/.test(b)?("-"===b.substr(0,1)?-1:1)*(60*parseInt(b.substr(1,2),10)+parseInt(b.substr(3,2),10)):parseInt(a,10)},$.timepicker.timezoneAdjust=function(a,b,c){var d=$.timepicker.timezoneOffsetNumber(b),e=$.timepicker.timezoneOffsetNumber(c);return isNaN(e)||a.setMinutes(a.getMinutes()+-d- -e),a},$.timepicker.timeRange=function(a,b,c){return $.timepicker.handleRange("timepicker",a,b,c)},$.timepicker.datetimeRange=function(a,b,c){$.timepicker.handleRange("datetimepicker",a,b,c)},$.timepicker.dateRange=function(a,b,c){$.timepicker.handleRange("datepicker",a,b,c)},$.timepicker.handleRange=function(a,b,c,d){function e(e,f){var g=b[a]("getDate"),h=c[a]("getDate"),i=e[a]("getDate");if(null!==g){var j=new Date(g.getTime()),k=new Date(g.getTime());j.setMilliseconds(j.getMilliseconds()+d.minInterval),k.setMilliseconds(k.getMilliseconds()+d.maxInterval),d.minInterval>0&&j>h?c[a]("setDate",j):d.maxInterval>0&&h>k?c[a]("setDate",k):g>h&&f[a]("setDate",i)}}function f(b,c,e){if(b.val()){var f=b[a].call(b,"getDate");null!==f&&d.minInterval>0&&("minDate"===e&&f.setMilliseconds(f.getMilliseconds()+d.minInterval),"maxDate"===e&&f.setMilliseconds(f.getMilliseconds()-d.minInterval)),f.getTime&&c[a].call(c,"option",e,f)}}d=$.extend({},{minInterval:0,maxInterval:0,start:{},end:{}},d);var g=!1;return"timepicker"===a&&(g=!0,a="datetimepicker"),$.fn[a].call(b,$.extend({timeOnly:g,onClose:function(a,b){e($(this),c)},onSelect:function(a){f($(this),c,"minDate")}},d,d.start)),$.fn[a].call(c,$.extend({timeOnly:g,onClose:function(a,c){e($(this),b)},onSelect:function(a){f($(this),b,"maxDate")}},d,d.end)),e(b,c),f(b,c,"minDate"),f(c,b,"maxDate"),$([b.get(0),c.get(0)])},$.timepicker.log=function(){window.console&&window.console.log&&window.console.log.apply&&window.console.log.apply(window.console,Array.prototype.slice.call(arguments))},$.timepicker._util={_extendRemove:extendRemove,_isEmptyObject:isEmptyObject,_convert24to12:convert24to12,_detectSupport:detectSupport,_selectLocalTimezone:selectLocalTimezone,_computeEffectiveSetting:computeEffectiveSetting,_splitDateTime:splitDateTime,_parseDateTimeInternal:parseDateTimeInternal},Date.prototype.getMicroseconds||(Date.prototype.microseconds=0,Date.prototype.getMicroseconds=function(){return this.microseconds},Date.prototype.setMicroseconds=function(a){return this.setMilliseconds(this.getMilliseconds()+Math.floor(a/1e3)),this.microseconds=a%1e3,this}),$.timepicker.version="1.6.3"}});
\ No newline at end of file
diff --git a/index.html b/index.html
deleted file mode 100644
index 2993db8..0000000
--- a/index.html
+++ /dev/null
@@ -1,936 +0,0 @@
-
-
-
-
- Adding a Timepicker to jQuery UI Datepicker
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Adding a Timepicker to jQuery UI Datepicker
-
-
The timepicker addon adds a timepicker to jQuery UI Datepicker, thus the datepicker and slider components (jQueryUI) are required for using any of these. In addition all datepicker options are still available through the timepicker addon.
-
-
If you are interested in contributing to Timepicker Addon please check it out on GitHub . If you do make additions please keep in mind I enjoy tabs over spaces,.. But contributions are welcome in any form.
-
-
Back to Blog or Follow on Twitter
-
-
Try my new app to keep you informed of your car's financing status and value.
-
-
Donation
-
Has this Timepicker Addon been helpful to you?
-
-
-
-
-
-
-
-
-
Getting Started
-
-
Highly Recommended
-
Subscribe to my blog via email and follow @PracticalWeb on Twitter. I post for nearly every new version, so you know about updates.
-
-
Download
-
Download Timepicker Addon
-
Download/Contribute on GitHub (Need the entire repo? Find a bug? See if its fixed here)
-
There is a small bit of required CSS (Download ):
-
/* css for timepicker */
-.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
-.ui-timepicker-div dl { text-align: left; }
-.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
-.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
-.ui-timepicker-div td { font-size: 90%; }
-.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
-
-.ui-timepicker-rtl{ direction: rtl; }
-.ui-timepicker-rtl dl { text-align: right; }
-.ui-timepicker-rtl dl dd { margin: 0 65px 10px 10px; }
-
-
-
Requirements
-
You also need to include jQuery and jQuery UI with datepicker and slider wigits. You should include them in your page in the following order:
-
- jQuery
- jQueryUI (with datepicker and slider wigits)
- Timepicker
-
-
-
-
Version
-
Version 1.2
-
-
Last updated on 02/02/2013
-
jQuery Timepicker Addon is currently available for use in all personal or commercial projects under both MIT and GPL licenses. This means that you can choose the license that best suits your project, and use it accordingly.
-
GPL License
-
MIT License
-
-
-
-
-
-
-
Options
-
-
The timepicker does inherit all options from datepicker. However, there are many options that are shared by them both, and many timepicker only options:
-
-
Localization Options
-
- currentText
- Default: "Now", A Localization Setting - Text for the Now button.
-
- closeText
- Default: "Done", A Localization Setting - Text for the Close button.
-
- amNames
- Default: ['AM', 'A'], A Localization Setting - Array of strings to try and parse against to determine AM.
-
- pmNames
- Default: ['PM', 'P'], A Localization Setting - Array of strings to try and parse against to determine PM.
-
- timeFormat
- Default: "HH:mm", A Localization Setting - String of format tokens to be replaced with the time. See Formatting .
-
- timeSuffix
- Default: "", A Localization Setting - String to place after the formatted time.
-
- timeOnlyTitle
- Default: "Choose Time", A Localization Setting - Title of the wigit when using only timepicker.
-
- timeText
- Default: "Time", A Localization Setting - Label used within timepicker for the formatted time.
-
- hourText
- Default: "Hour", A Localization Setting - Label used to identify the hour slider.
-
- minuteText
- Default: "Minute", A Localization Setting - Label used to identify the minute slider.
-
- secondText
- Default: "Second", A Localization Setting - Label used to identify the second slider.
-
- millisecText
- Default: "Millisecond", A Localization Setting - Label used to identify the millisecond slider.
-
- timezoneText
- Default: "Timezone", A Localization Setting - Label used to identify the timezone slider.
-
- isRTL
- Default: false, A Localization Setting - Right to Left support.
-
-
-
Alt Field Options
-
-
- altFieldTimeOnly
- Default: true - When altField is used from datepicker altField will only receive the formatted time and the original field only receives date.
-
- altSeparator
- Default: (separator option) - String placed between formatted date and formatted time in the altField.
-
- altTimeSuffix
- Default: (timeSuffix option) - String always placed after the formatted time in the altField.
-
- altTimeFormat
- Default: (timeFormat option) - The time format to use with the altField.
-
-
-
Timezone Options
-
-
- useLocalTimezone
- Default: false - Whether to default timezone to the browser's set timezone.
-
- defaultTimezone
- Default: "+0000" - If not set, the default timezone used.
-
- timezoneIso8601
- Default: false - Whether to follow the ISO 8601 standard.
-
- timezoneList
- Default: [generated timezones] - An array of timezones used to populate the timezone select. Can be an array of values or an array of objects: { label: "EST", value: "+0400" }
-
-
-
Time Field Options
-
-
- controlType
- Default: 'slider' - Whether to use 'slider' or 'select'. If 'slider' is unavailable through jQueryUI, 'select' will be used. For advanced usage you may pass an object which implements "create", "options", "value" methods to use controls other than sliders or selects. See the _controls property in the source code for more details.
-{
- create: function(tp_inst, obj, unit, val, min, max, step){
- // generate whatever controls you want here, just return obj
- },
- options: function(tp_inst, obj, unit, opts, val){
- // if val==undefined return the value, else return obj
- },
- value: function(tp_inst, obj, unit, val){
- // if val==undefined return the value, else return obj
- }
-}
-
-
- showHour
- Default: true - Whether to show the hour slider.
-
- showMinute
- Default: true - Whether to show the minute slider.
-
- showSecond
- Default: false - Whether to show the second slider.
-
- showMillisec
- Default: false - Whether to show the millisecond slider.
-
- showTimezone
- Default: false - Whether to show the timezone select.
-
- showTime
- Default: true - Whether to show the time selected within the datetimepicker.
-
- stepHour
- Default: 1 - Hours per step the slider makes.
-
- stepMinute
- Default: 1 - Minutes per step the slider makes.
-
- stepSecond
- Default: 1 - Seconds per step the slider makes.
-
- stepMilliSec
- Default: 1 - Milliseconds per step the slider makes.
-
- hour
- Default: 0 - Initial hour set.
-
- minute
- Default: 0 - Initial minute set.
-
- second
- Default: 0 - Initial second set.
-
- millisec
- Default: 0 - Initial millisecond set.
-
- timezone
- Default: 0 - Initial timezone set.
-
- hourMin
- Default: 0 - The minimum hour allowed for all dates.
-
- minuteMin
- Default: 0 - The minimum minute allowed for all dates.
-
- secondMin
- Default: 0 - The minimum second allowed for all dates.
-
- millisecMin
- Default: 0 - The minimum millisecond allowed for all dates.
-
- hourMax
- Default: 23 - The maximum hour allowed for all dates.
-
- minuteMax
- Default: 59 - The maximum minute allowed for all dates.
-
- secondMax
- Default: 59 - The maximum second allowed for all dates.
-
- millisecMax
- Default: 999 - The maximum millisecond allowed for all dates.
-
- hourGrid
- Default: 0 - When greater than 0 a label grid will be generated under the slider. This number represents the units (in hours) between labels.
-
- minuteGrid
- Default: 0 - When greater than 0 a label grid will be generated under the slider. This number represents the units (in minutes) between labels.
-
- secondGrid
- Default: 0 - When greater than 0 a label grid will be genereated under the slider. This number represents the units (in seconds) between labels.
-
- millisecGrid
- Default: 0 - When greater than 0 a label grid will be genereated under the slider. This number represents the units (in milliseconds) between labels.
-
-
-
Other Options
-
- showButtonPanel
- Default: true - Whether to show the button panel at the bottom. This is generally needed.
-
- timeOnly
- Default: false - Hide the datepicker and only provide a time interface.
-
- onSelect
- Default: null - Function to be called when a date is chosen or time has changed (parameters: datetimeText, datepickerInstance).
-
- alwaysSetTime
- Default: true - Always have a time set internally, even before user has chosen one.
-
- separator
- Default: " " - When formatting the time this string is placed between the formatted date and formatted time.
-
- pickerTimeFormat
- Default: (timeFormat option) - How to format the time displayed within the timepicker.
-
- pickerTimeSuffix
- Default: (timeSuffix option) - String to place after the formatted time within the timepicker.
-
- showTimepicker
- Default: true - Whether to show the timepicker within the datepicker.
-
- addSliderAccess
- Default: false - Adds the sliderAccess plugin to sliders within timepicker
-
- sliderAccessArgs
- Default: null - Object to pass to sliderAccess when used.
-
- defaultValue
- Default: null - String of the default time value placed in the input on focus when the input is empty.
-
- minDateTime
- Default: null - Date object of the minimum datetime allowed. Also available as minDate.
-
- maxDateTime
- Default: null - Date object of the maximum datetime allowed. Also Available as maxDate.
-
- parse
- Default: 'strict' - How to parse the time string. Two methods are provided: 'strict' which must match the timeFormat exactly, and 'loose' which uses javascript's new Date(timeString) to guess the time. You may also pass in a function(timeFormat, timeString, options) to handle the parsing yourself, returning a simple object:
-{
- hour: 19,
- minute: 10,
- second: 23,
- millisec: 45,
- timezone: '-0400'
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Working with Localizations
-
-
Timepicker comes with many translations and localizations, thanks to all the contributors. They can be found in the localization folder in the git repo.
-
-
The quick and cheap way to use localizations is to pass in options to a timepicker instance:
-
-
$('#example123').timepicker({
- timeOnlyTitle: 'Выберите время',
- timeText: 'Время',
- hourText: 'Часы',
- minuteText: 'Минуты',
- secondText: 'Секунды',
- currentText: 'Теперь',
- closeText: 'Закрыть'
-});
-
-
However, if you plan to use timepicker extensively you will need to include (build your own) localization. It is simply assigning those same variables to an object. As you see in the example below we maintain a separate object for timepicker. This way we aren't bound to any changes within datepicker.
-
-
$.datepicker.regional['ru'] = {
- closeText: 'Закрыть',
- prevText: '<Пред',
- nextText: 'След>',
- currentText: 'Сегодня',
- monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь',
- 'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
- monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',
- 'Июл','Авг','Сен','Окт','Ноя','Дек'],
- dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'],
- dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
- dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
- weekHeader: 'Не',
- dateFormat: 'dd.mm.yy',
- firstDay: 1,
- isRTL: false,
- showMonthAfterYear: false,
- yearSuffix: ''
-};
-$.datepicker.setDefaults($.datepicker.regional['ru']);
-
-
-$.timepicker.regional['ru'] = {
- timeOnlyTitle: 'Выберите время',
- timeText: 'Время',
- hourText: 'Часы',
- minuteText: 'Минуты',
- secondText: 'Секунды',
- millisecText: 'Миллисекунды',
- timezoneText: 'Часовой пояс',
- currentText: 'Сейчас',
- closeText: 'Закрыть',
- timeFormat: 'HH:mm',
- amNames: ['AM', 'A'],
- pmNames: ['PM', 'P'],
- isRTL: false
-};
-$.timepicker.setDefaults($.timepicker.regional['ru']);
-
-
Now all you have to do is call timepicker and the Russian localization is used. Generally you only need to include the localization file, it will setDefaults() for you.
-
You can also visit localization for datepicker for more information about datepicker localizations.
-
-
-
-
-
-
Examples
-
-
-
-
Basic Initializations
-
-
-
-
Add a simple datetimepicker to jQuery UI's datepicker
-
-
-
-
-$('#basic_example_1').datetimepicker();
-
-
-
-
-
-
-
Add only a timepicker:
-
-
-
-
-$('#basic_example_2').timepicker();
-
-
-
-
-
-
Format the time:
-
-
-
-
-$('#basic_example_3').datetimepicker({
- timeFormat: "hh:mm tt"
-});
-
-
-
-
Using Timezones
-
-
-
-
Simplest timezone usage:
-
-
-
-
-$('#timezone_example_1').datetimepicker({
- timeFormat: 'hh:mm tt z',
- showTimezone: true
-});
-
-
-
-
-
-
Define your own timezone options:
-
-
-
-
-$('#timezone_example_2').datetimepicker({
- timeFormat: 'HH:mm z',
- showTimezone: true,
- timezoneList: [
- { value: '-0500', label: 'Eastern'},
- { value: '-0600', label: 'Central' },
- { value: '-0700', label: 'Mountain' },
- { value: '-0800', label: 'Pacific' }
- ]
-});
-
-
-
-
-
-
Use timezone string abbreviations for values:
-
-
-
-
-$('#timezone_example_3').datetimepicker({
- timeFormat: 'HH:mm z',
- showTimezone: true,
- timezone: 'MT',
- timezoneList: [
- { value: 'ET', label: 'Eastern'},
- { value: 'CT', label: 'Central' },
- { value: 'MT', label: 'Mountain' },
- { value: 'PT', label: 'Pacific' }
- ]
-});
-
-
-
-
-
Slider Modifications
-
-
-
-
Add a grid to each slider:
-
-
-
-
-$('#slider_example_1').timepicker({
- hourGrid: 4,
- minuteGrid: 10,
- timeFormat: 'hh:mm tt'
-});
-
-
-
-
-
-
Set the interval step of sliders:
-
-
-
-
-$('#slider_example_2').datetimepicker({
- showSecond: true,
- timeFormat: 'HH:mm:ss',
- stepHour: 2,
- stepMinute: 10,
- stepSecond: 10
-});
-
-
-
-
-
-
Add sliderAccess plugin for touch devices:
-
-
-
-
-$('#slider_example_3').datetimepicker({
- addSliderAccess: true,
- sliderAccessArgs: { touchonly: false }
-});
-
-
-
-
-
Use dropdowns instead of sliders. By default if slider is not available dropdowns will be used.
-
-
-
-
-$('#slider_example_4').datetimepicker({
- controlType: 'select',
- timeFormat: 'hh:mm tt'
-});
-
-
-
-
-
Create your own control by implementing the create, options, and value methods. If you want to use your new control for all instances use the $.timepicker.setDefaults({controlType:myControl}). Here we implement jQueryUI's spinner control (jQueryUI 1.9+).
-
-
-
-
var myControl= {
- create: function(tp_inst, obj, unit, val, min, max, step){
- $('<input class="ui-timepicker-input" value="'+val+'" style="width:50%">')
- .appendTo(obj)
- .spinner({
- min: min,
- max: max,
- step: step,
- change: function(e,ui){ // key events
- // don't call if api was used and not key press
- if(e.originalEvent !== undefined)
- tp_inst._onTimeChange();
- tp_inst._onSelectHandler();
- },
- spin: function(e,ui){ // spin events
- tp_inst.control.value(tp_inst, obj, unit, ui.value);
- tp_inst._onTimeChange();
- tp_inst._onSelectHandler();
- }
- });
- return obj;
- },
- options: function(tp_inst, obj, unit, opts, val){
- if(typeof(opts) == 'string' && val !== undefined)
- return obj.find('.ui-timepicker-input').spinner(opts, val);
- return obj.find('.ui-timepicker-input').spinner(opts);
- },
- value: function(tp_inst, obj, unit, val){
- if(val !== undefined)
- return obj.find('.ui-timepicker-input').spinner('value', val);
- return obj.find('.ui-timepicker-input').spinner('value');
- }
-};
-
-$('#slider_example_5').datetimepicker({
- controlType: myControl
-});
-
-
-
Alternate Fields
-
-
-
-
Alt field in the simplest form:
-
-
-
-
-
-$('#alt_example_1').datetimepicker({
- altField: "#alt_example_1_alt"
-});
-
-
-
-
-
-
With datetime in both:
-
-
-
-
-
-$('#alt_example_2').datetimepicker({
- altField: "#alt_example_2_alt",
- altFieldTimeOnly: false
-});
-
-
-
-
-
-
Format the altField differently:
-
-
-
-
-
-$('#alt_example_3').datetimepicker({
- altField: "#alt_example_3_alt",
- altFieldTimeOnly: false,
- altFormat: "yy-mm-dd",
- altTimeFormat: "h:m t",
- altSeparator: " @ "
-});
-
-
-
-
-
-
With inline mode using altField:
-
-
-
-
-
-$('#alt_example_4').datetimepicker({
- altField: "#alt_example_4_alt",
- altFieldTimeOnly: false
-});
-
-
-
-
Time Restraints
-
-
-
-
Set the min/max hour of every date:
-
-
-
-
-$('#rest_example_1').timepicker({
- hourMin: 8,
- hourMax: 16
-});
-
-
-
-
-
-
Set the min/max date numerically:
-
-
-
-
-$('#rest_example_2').datetimepicker({
- numberOfMonths: 2,
- minDate: 0,
- maxDate: 30
-});
-
-
-
-
-
-
Set the min/max date and time with a Date object:
-
-
-
-
-$('#rest_example_3').datetimepicker({
- minDate: new Date(2010, 11, 20, 8, 30),
- maxDate: new Date(2010, 11, 31, 17, 30)
-});
-
-
-
-
-
-
Restrict a start and end date (also shows using onSelect and onClose events):
-
-
-
-
-
-var startDateTextBox = $('#rest_example_4_start');
-var endDateTextBox = $('#rest_example_4_end');
-
-startDateTextBox.datetimepicker({
- onClose: function(dateText, inst) {
- if (endDateTextBox.val() != '') {
- var testStartDate = startDateTextBox.datetimepicker('getDate');
- var testEndDate = endDateTextBox.datetimepicker('getDate');
- if (testStartDate > testEndDate)
- endDateTextBox.datetimepicker('setDate', testStartDate);
- }
- else {
- endDateTextBox.val(dateText);
- }
- },
- onSelect: function (selectedDateTime){
- endDateTextBox.datetimepicker('option', 'minDate', startDateTextBox.datetimepicker('getDate') );
- }
-});
-endDateTextBox.datetimepicker({
- onClose: function(dateText, inst) {
- if (startDateTextBox.val() != '') {
- var testStartDate = startDateTextBox.datetimepicker('getDate');
- var testEndDate = endDateTextBox.datetimepicker('getDate');
- if (testStartDate > testEndDate)
- startDateTextBox.datetimepicker('setDate', testEndDate);
- }
- else {
- startDateTextBox.val(dateText);
- }
- },
- onSelect: function (selectedDateTime){
- startDateTextBox.datetimepicker('option', 'maxDate', endDateTextBox.datetimepicker('getDate') );
- }
-});
-
-
-
-
-
Utilities
-
-
-
-
Get and Set Datetime:
-
-
- Set Datetime
- Get Datetime
-
-
-
-var ex13 = $('#utility_example_1');
-
-ex13.datetimepicker({
- dateFormat: "D MM d, yy",
- separator: ' @ '
-});
-
-$('#utility_example_1_setdt').click(function(){
- ex13.datetimepicker('setDate', (new Date()) );
-});
-
-$('#utility_example_1_getdt').click(function(){
- alert(ex13.datetimepicker('getDate'));
-});
-
-
-
-
-
-
Use the utility function to format your own time. $.datepicker.formatTime(format, time, options)
-
- format required - string represenation of the time format to use
- time required - hash: { hour, minute, second, millisecond, timezone }
- options optional - hash of any options in regional translation (ampm, amNames, pmNames..)
-
-
Returns a time string in the specified format.
-
-
-
-$('#utility_example_2').text(
- $.datepicker.formatTime('HH:mm z', { hour: 14, minute: 36, timezone: '+2000' }, {})
-);
-
-
-
-
-
-
Use the utility function to parses a formatted time. $.datepicker.parseTime(format, timeString, options)
-
- format required - string represenation of the time format to use
- time required - time string matching the format given in parameter 1
- options optional - hash of any options in regional translation (ampm, amNames, pmNames..)
-
-
Returns an object with hours, minutes, seconds, milliseconds, timezone.
-
-
-
-$('#utility_example_3').text(JSON.stringify(
- $.datepicker.parseTime('HH:mm:ss:l z', "14:36:21:765 +2000", {})
-));
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jquery-ui-timepicker-addon.css b/jquery-ui-timepicker-addon.css
deleted file mode 100644
index b93a85f..0000000
--- a/jquery-ui-timepicker-addon.css
+++ /dev/null
@@ -1,10 +0,0 @@
-.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
-.ui-timepicker-div dl { text-align: left; }
-.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
-.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
-.ui-timepicker-div td { font-size: 90%; }
-.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
-
-.ui-timepicker-rtl{ direction: rtl; }
-.ui-timepicker-rtl dl { text-align: right; }
-.ui-timepicker-rtl dl dd { margin: 0 65px 10px 10px; }
\ No newline at end of file
diff --git a/jquery-ui-timepicker-addon.js b/jquery-ui-timepicker-addon.js
deleted file mode 100644
index f9b5faa..0000000
--- a/jquery-ui-timepicker-addon.js
+++ /dev/null
@@ -1,1919 +0,0 @@
-/*
- * jQuery timepicker addon
- * By: Trent Richardson [http://trentrichardson.com]
- * Version 1.2
- * Last Modified: 02/02/2013
- *
- * Copyright 2013 Trent Richardson
- * You may use this project under MIT or GPL licenses.
- * http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
- * http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
- */
-
-/*jslint evil: true, white: false, undef: false, nomen: false */
-
-(function($) {
-
- /*
- * Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded"
- */
- $.ui.timepicker = $.ui.timepicker || {};
- if ($.ui.timepicker.version) {
- return;
- }
-
- /*
- * Extend jQueryUI, get it started with our version number
- */
- $.extend($.ui, {
- timepicker: {
- version: "1.2"
- }
- });
-
- /*
- * Timepicker manager.
- * Use the singleton instance of this class, $.timepicker, to interact with the time picker.
- * Settings for (groups of) time pickers are maintained in an instance object,
- * allowing multiple different settings on the same page.
- */
- var Timepicker = function() {
- this.regional = []; // Available regional settings, indexed by language code
- this.regional[''] = { // Default regional settings
- currentText: 'Now',
- closeText: 'Done',
- amNames: ['AM', 'A'],
- pmNames: ['PM', 'P'],
- timeFormat: 'HH:mm',
- timeSuffix: '',
- timeOnlyTitle: 'Choose Time',
- timeText: 'Time',
- hourText: 'Hour',
- minuteText: 'Minute',
- secondText: 'Second',
- millisecText: 'Millisecond',
- timezoneText: 'Time Zone',
- isRTL: false
- };
- this._defaults = { // Global defaults for all the datetime picker instances
- showButtonPanel: true,
- timeOnly: false,
- showHour: true,
- showMinute: true,
- showSecond: false,
- showMillisec: false,
- showTimezone: false,
- showTime: true,
- stepHour: 1,
- stepMinute: 1,
- stepSecond: 1,
- stepMillisec: 1,
- hour: 0,
- minute: 0,
- second: 0,
- millisec: 0,
- timezone: null,
- useLocalTimezone: false,
- defaultTimezone: "+0000",
- hourMin: 0,
- minuteMin: 0,
- secondMin: 0,
- millisecMin: 0,
- hourMax: 23,
- minuteMax: 59,
- secondMax: 59,
- millisecMax: 999,
- minDateTime: null,
- maxDateTime: null,
- onSelect: null,
- hourGrid: 0,
- minuteGrid: 0,
- secondGrid: 0,
- millisecGrid: 0,
- alwaysSetTime: true,
- separator: ' ',
- altFieldTimeOnly: true,
- altTimeFormat: null,
- altSeparator: null,
- altTimeSuffix: null,
- pickerTimeFormat: null,
- pickerTimeSuffix: null,
- showTimepicker: true,
- timezoneIso8601: false,
- timezoneList: null,
- addSliderAccess: false,
- sliderAccessArgs: null,
- controlType: 'slider',
- defaultValue: null,
- parse: 'strict'
- };
- $.extend(this._defaults, this.regional['']);
- };
-
- $.extend(Timepicker.prototype, {
- $input: null,
- $altInput: null,
- $timeObj: null,
- inst: null,
- hour_slider: null,
- minute_slider: null,
- second_slider: null,
- millisec_slider: null,
- timezone_select: null,
- hour: 0,
- minute: 0,
- second: 0,
- millisec: 0,
- timezone: null,
- defaultTimezone: "+0000",
- hourMinOriginal: null,
- minuteMinOriginal: null,
- secondMinOriginal: null,
- millisecMinOriginal: null,
- hourMaxOriginal: null,
- minuteMaxOriginal: null,
- secondMaxOriginal: null,
- millisecMaxOriginal: null,
- ampm: '',
- formattedDate: '',
- formattedTime: '',
- formattedDateTime: '',
- timezoneList: null,
- units: ['hour','minute','second','millisec'],
- control: null,
-
- /*
- * Override the default settings for all instances of the time picker.
- * @param settings object - the new settings to use as defaults (anonymous object)
- * @return the manager object
- */
- setDefaults: function(settings) {
- extendRemove(this._defaults, settings || {});
- return this;
- },
-
- /*
- * Create a new Timepicker instance
- */
- _newInst: function($input, o) {
- var tp_inst = new Timepicker(),
- inlineSettings = {},
- fns = {},
- overrides, i;
-
- for (var attrName in this._defaults) {
- if(this._defaults.hasOwnProperty(attrName)){
- var attrValue = $input.attr('time:' + attrName);
- if (attrValue) {
- try {
- inlineSettings[attrName] = eval(attrValue);
- } catch (err) {
- inlineSettings[attrName] = attrValue;
- }
- }
- }
- }
- overrides = {
- beforeShow: function (input, dp_inst) {
- if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) {
- return tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst);
- }
- },
- onChangeMonthYear: function (year, month, dp_inst) {
- // Update the time as well : this prevents the time from disappearing from the $input field.
- tp_inst._updateDateTime(dp_inst);
- if ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) {
- tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
- }
- },
- onClose: function (dateText, dp_inst) {
- if (tp_inst.timeDefined === true && $input.val() !== '') {
- tp_inst._updateDateTime(dp_inst);
- }
- if ($.isFunction(tp_inst._defaults.evnts.onClose)) {
- tp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst);
- }
- }
- };
- for (i in overrides) {
- if (overrides.hasOwnProperty(i)) {
- fns[i] = o[i] || null;
- }
- }
- tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, overrides, {
- evnts:fns,
- timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
- });
- tp_inst.amNames = $.map(tp_inst._defaults.amNames, function(val) {
- return val.toUpperCase();
- });
- tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function(val) {
- return val.toUpperCase();
- });
-
- // controlType is string - key to our this._controls
- if(typeof(tp_inst._defaults.controlType) === 'string'){
- if($.fn[tp_inst._defaults.controlType] === undefined){
- tp_inst._defaults.controlType = 'select';
- }
- tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];
- }
- // controlType is an object and must implement create, options, value methods
- else{
- tp_inst.control = tp_inst._defaults.controlType;
- }
-
- if (tp_inst._defaults.timezoneList === null) {
- var timezoneList = ['-1200', '-1100', '-1000', '-0930', '-0900', '-0800', '-0700', '-0600', '-0500', '-0430', '-0400', '-0330', '-0300', '-0200', '-0100', '+0000',
- '+0100', '+0200', '+0300', '+0330', '+0400', '+0430', '+0500', '+0530', '+0545', '+0600', '+0630', '+0700', '+0800', '+0845', '+0900', '+0930',
- '+1000', '+1030', '+1100', '+1130', '+1200', '+1245', '+1300', '+1400'];
-
- if (tp_inst._defaults.timezoneIso8601) {
- timezoneList = $.map(timezoneList, function(val) {
- return val == '+0000' ? 'Z' : (val.substring(0, 3) + ':' + val.substring(3));
- });
- }
- tp_inst._defaults.timezoneList = timezoneList;
- }
-
- tp_inst.timezone = tp_inst._defaults.timezone;
- tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin? tp_inst._defaults.hourMin :
- tp_inst._defaults.hour > tp_inst._defaults.hourMax? tp_inst._defaults.hourMax : tp_inst._defaults.hour;
- tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin? tp_inst._defaults.minuteMin :
- tp_inst._defaults.minute > tp_inst._defaults.minuteMax? tp_inst._defaults.minuteMax : tp_inst._defaults.minute;
- tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin? tp_inst._defaults.secondMin :
- tp_inst._defaults.second > tp_inst._defaults.secondMax? tp_inst._defaults.secondMax : tp_inst._defaults.second;
- tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin? tp_inst._defaults.millisecMin :
- tp_inst._defaults.millisec > tp_inst._defaults.millisecMax? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec;
- tp_inst.ampm = '';
- tp_inst.$input = $input;
-
- if (o.altField) {
- tp_inst.$altInput = $(o.altField).css({
- cursor: 'pointer'
- }).focus(function() {
- $input.trigger("focus");
- });
- }
-
- if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) {
- tp_inst._defaults.minDate = new Date();
- }
- if (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) {
- tp_inst._defaults.maxDate = new Date();
- }
-
- // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
- if (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) {
- tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
- }
- if (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) {
- tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
- }
- if (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) {
- tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
- }
- if (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) {
- tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
- }
- tp_inst.$input.bind('focus', function() {
- tp_inst._onFocus();
- });
-
- return tp_inst;
- },
-
- /*
- * add our sliders to the calendar
- */
- _addTimePicker: function(dp_inst) {
- var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val();
-
- this.timeDefined = this._parseTime(currDT);
- this._limitMinMaxDateTime(dp_inst, false);
- this._injectTimePicker();
- },
-
- /*
- * parse the time string from input value or _setTime
- */
- _parseTime: function(timeString, withDate) {
- if (!this.inst) {
- this.inst = $.datepicker._getInst(this.$input[0]);
- }
-
- if (withDate || !this._defaults.timeOnly) {
- var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
- try {
- var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults);
- if (!parseRes.timeObj) {
- return false;
- }
- $.extend(this, parseRes.timeObj);
- } catch (err) {
- $.timepicker.log("Error parsing the date/time string: " + err +
- "\ndate/time string = " + timeString +
- "\ntimeFormat = " + this._defaults.timeFormat +
- "\ndateFormat = " + dp_dateFormat);
- return false;
- }
- return true;
- } else {
- var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults);
- if (!timeObj) {
- return false;
- }
- $.extend(this, timeObj);
- return true;
- }
- },
-
- /*
- * generate and inject html for timepicker into ui datepicker
- */
- _injectTimePicker: function() {
- var $dp = this.inst.dpDiv,
- o = this.inst.settings,
- tp_inst = this,
- litem = '',
- uitem = '',
- max = {},
- gridSize = {},
- size = null;
-
- // Prevent displaying twice
- if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
- var noDisplay = ' style="display:none;"',
- html = '' + '' + o.timeText + ' ' +
- ' ';
-
- // Create the markup
- for(var i=0,l=this.units.length; i
';
-
- if (o['show'+uitem] && o[litem+'Grid'] > 0) {
- html += '';
-
- if(litem == 'hour'){
- for (var h = o[litem+'Min']; h <= max[litem]; h += parseInt(o[litem+'Grid'], 10)) {
- gridSize[litem]++;
- var tmph = $.datepicker.formatTime(useAmpm(o.pickerTimeFormat || o.timeFormat)? 'hht':'HH', {hour:h}, o);
- html += '' + tmph + ' ';
- }
- }
- else{
- for (var m = o[litem+'Min']; m <= max[litem]; m += parseInt(o[litem+'Grid'], 10)) {
- gridSize[litem]++;
- html += '' + ((m < 10) ? '0' : '') + m + ' ';
- }
- }
-
- html += '
';
- }
- html += '';
- }
-
- // Timezone
- html += '' + o.timezoneText + ' ';
- html += ' ';
-
- // Create the elements from string
- html += ' ';
- var $tp = $(html);
-
- // if we only want time picker...
- if (o.timeOnly === true) {
- $tp.prepend('');
- $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
- }
-
- // add sliders, adjust grids, add events
- for(var i=0,l=tp_inst.units.length; i 0) {
- size = 100 * gridSize[litem] * o[litem+'Grid'] / (max[litem] - o[litem+'Min']);
- $tp.find('.ui_tpicker_'+litem+' table').css({
- width: size + "%",
- marginLeft: o.isRTL? '0' : ((size / (-2 * gridSize[litem])) + "%"),
- marginRight: o.isRTL? ((size / (-2 * gridSize[litem])) + "%") : '0',
- borderCollapse: 'collapse'
- }).find("td").click(function(e){
- var $t = $(this),
- h = $t.html(),
- n = parseInt(h.replace(/[^0-9]/g),10),
- ap = h.replace(/[^apm]/ig),
- f = $t.data('for'); // loses scope, so we use data-for
-
- if(f == 'hour'){
- if(ap.indexOf('p') !== -1 && n < 12){
- n += 12;
- }
- else{
- if(ap.indexOf('a') !== -1 && n === 12){
- n = 0;
- }
- }
- }
-
- tp_inst.control.value(tp_inst, tp_inst[f+'_slider'], litem, n);
-
- tp_inst._onTimeChange();
- tp_inst._onSelectHandler();
- })
- .css({
- cursor: 'pointer',
- width: (100 / gridSize[litem]) + '%',
- textAlign: 'center',
- overflow: 'hidden'
- });
- } // end if grid > 0
- } // end for loop
-
- // Add timezone options
- this.timezone_select = $tp.find('.ui_tpicker_timezone').append(' ').find("select");
- $.fn.append.apply(this.timezone_select,
- $.map(o.timezoneList, function(val, idx) {
- return $(" ").val(typeof val == "object" ? val.value : val).text(typeof val == "object" ? val.label : val);
- }));
- if (typeof(this.timezone) != "undefined" && this.timezone !== null && this.timezone !== "") {
- var local_date = new Date(this.inst.selectedYear, this.inst.selectedMonth, this.inst.selectedDay, 12);
- var local_timezone = $.timepicker.timeZoneOffsetString(local_date);
- if (local_timezone == this.timezone) {
- selectLocalTimeZone(tp_inst);
- } else {
- this.timezone_select.val(this.timezone);
- }
- } else {
- if (typeof(this.hour) != "undefined" && this.hour !== null && this.hour !== "") {
- this.timezone_select.val(o.defaultTimezone);
- } else {
- selectLocalTimeZone(tp_inst);
- }
- }
- this.timezone_select.change(function() {
- tp_inst._defaults.useLocalTimezone = false;
- tp_inst._onTimeChange();
- tp_inst._onSelectHandler();
- });
- // End timezone options
-
- // inject timepicker into datepicker
- var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
- if ($buttonPanel.length) {
- $buttonPanel.before($tp);
- } else {
- $dp.append($tp);
- }
-
- this.$timeObj = $tp.find('.ui_tpicker_time');
-
- if (this.inst !== null) {
- var timeDefined = this.timeDefined;
- this._onTimeChange();
- this.timeDefined = timeDefined;
- }
-
- // slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
- if (this._defaults.addSliderAccess) {
- var sliderAccessArgs = this._defaults.sliderAccessArgs,
- rtl = this._defaults.isRTL;
- sliderAccessArgs.isRTL = rtl;
-
- setTimeout(function() { // fix for inline mode
- if ($tp.find('.ui-slider-access').length === 0) {
- $tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
-
- // fix any grids since sliders are shorter
- var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
- if (sliderAccessWidth) {
- $tp.find('table:visible').each(function() {
- var $g = $(this),
- oldWidth = $g.outerWidth(),
- oldMarginLeft = $g.css(rtl? 'marginRight':'marginLeft').toString().replace('%', ''),
- newWidth = oldWidth - sliderAccessWidth,
- newMarginLeft = ((oldMarginLeft * newWidth) / oldWidth) + '%',
- css = { width: newWidth, marginRight: 0, marginLeft: 0 };
- css[rtl? 'marginRight':'marginLeft'] = newMarginLeft;
- $g.css(css);
- });
- }
- }
- }, 10);
- }
- // end slideAccess integration
-
- }
- },
-
- /*
- * This function tries to limit the ability to go outside the
- * min/max date range
- */
- _limitMinMaxDateTime: function(dp_inst, adjustSliders) {
- var o = this._defaults,
- dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);
-
- if (!this._defaults.showTimepicker) {
- return;
- } // No time so nothing to check here
-
- if ($.datepicker._get(dp_inst, 'minDateTime') !== null && $.datepicker._get(dp_inst, 'minDateTime') !== undefined && dp_date) {
- var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
- minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
-
- if (this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null) {
- this.hourMinOriginal = o.hourMin;
- this.minuteMinOriginal = o.minuteMin;
- this.secondMinOriginal = o.secondMin;
- this.millisecMinOriginal = o.millisecMin;
- }
-
- if (dp_inst.settings.timeOnly || minDateTimeDate.getTime() == dp_date.getTime()) {
- this._defaults.hourMin = minDateTime.getHours();
- if (this.hour <= this._defaults.hourMin) {
- this.hour = this._defaults.hourMin;
- this._defaults.minuteMin = minDateTime.getMinutes();
- if (this.minute <= this._defaults.minuteMin) {
- this.minute = this._defaults.minuteMin;
- this._defaults.secondMin = minDateTime.getSeconds();
- if (this.second <= this._defaults.secondMin) {
- this.second = this._defaults.secondMin;
- this._defaults.millisecMin = minDateTime.getMilliseconds();
- } else {
- if (this.millisec < this._defaults.millisecMin) {
- this.millisec = this._defaults.millisecMin;
- }
- this._defaults.millisecMin = this.millisecMinOriginal;
- }
- } else {
- this._defaults.secondMin = this.secondMinOriginal;
- this._defaults.millisecMin = this.millisecMinOriginal;
- }
- } else {
- this._defaults.minuteMin = this.minuteMinOriginal;
- this._defaults.secondMin = this.secondMinOriginal;
- this._defaults.millisecMin = this.millisecMinOriginal;
- }
- } else {
- this._defaults.hourMin = this.hourMinOriginal;
- this._defaults.minuteMin = this.minuteMinOriginal;
- this._defaults.secondMin = this.secondMinOriginal;
- this._defaults.millisecMin = this.millisecMinOriginal;
- }
- }
-
- if ($.datepicker._get(dp_inst, 'maxDateTime') !== null && $.datepicker._get(dp_inst, 'maxDateTime') !== undefined && dp_date) {
- var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
- maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
-
- if (this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null) {
- this.hourMaxOriginal = o.hourMax;
- this.minuteMaxOriginal = o.minuteMax;
- this.secondMaxOriginal = o.secondMax;
- this.millisecMaxOriginal = o.millisecMax;
- }
-
- if (dp_inst.settings.timeOnly || maxDateTimeDate.getTime() == dp_date.getTime()) {
- this._defaults.hourMax = maxDateTime.getHours();
- if (this.hour >= this._defaults.hourMax) {
- this.hour = this._defaults.hourMax;
- this._defaults.minuteMax = maxDateTime.getMinutes();
- if (this.minute >= this._defaults.minuteMax) {
- this.minute = this._defaults.minuteMax;
- this._defaults.secondMax = maxDateTime.getSeconds();
- if (this.second >= this._defaults.secondMax) {
- this.second = this._defaults.secondMax;
- this._defaults.millisecMax = maxDateTime.getMilliseconds();
- } else {
- if (this.millisec > this._defaults.millisecMax) {
- this.millisec = this._defaults.millisecMax;
- }
- this._defaults.millisecMax = this.millisecMaxOriginal;
- }
- } else {
- this._defaults.secondMax = this.secondMaxOriginal;
- this._defaults.millisecMax = this.millisecMaxOriginal;
- }
- } else {
- this._defaults.minuteMax = this.minuteMaxOriginal;
- this._defaults.secondMax = this.secondMaxOriginal;
- this._defaults.millisecMax = this.millisecMaxOriginal;
- }
- } else {
- this._defaults.hourMax = this.hourMaxOriginal;
- this._defaults.minuteMax = this.minuteMaxOriginal;
- this._defaults.secondMax = this.secondMaxOriginal;
- this._defaults.millisecMax = this.millisecMaxOriginal;
- }
- }
-
- if (adjustSliders !== undefined && adjustSliders === true) {
- var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)), 10),
- minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)), 10),
- secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)), 10),
- millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)), 10);
-
- if (this.hour_slider) {
- this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax });
- this.control.value(this, this.hour_slider, 'hour', this.hour - (this.hour % this._defaults.stepHour));
- }
- if (this.minute_slider) {
- this.control.options(this, this.minute_slider, 'minute', { min: this._defaults.minuteMin, max: minMax });
- this.control.value(this, this.minute_slider, 'minute', this.minute - (this.minute % this._defaults.stepMinute));
- }
- if (this.second_slider) {
- this.control.options(this, this.second_slider, 'second', { min: this._defaults.secondMin, max: secMax });
- this.control.value(this, this.second_slider, 'second', this.second - (this.second % this._defaults.stepSecond));
- }
- if (this.millisec_slider) {
- this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax });
- this.control.value(this, this.millisec_slider, 'millisec', this.millisec - (this.millisec % this._defaults.stepMillisec));
- }
- }
-
- },
-
- /*
- * when a slider moves, set the internal time...
- * on time change is also called when the time is updated in the text field
- */
- _onTimeChange: function() {
- var hour = (this.hour_slider) ? this.control.value(this, this.hour_slider, 'hour') : false,
- minute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false,
- second = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false,
- millisec = (this.millisec_slider) ? this.control.value(this, this.millisec_slider, 'millisec') : false,
- timezone = (this.timezone_select) ? this.timezone_select.val() : false,
- o = this._defaults,
- pickerTimeFormat = o.pickerTimeFormat || o.timeFormat,
- pickerTimeSuffix = o.pickerTimeSuffix || o.timeSuffix;
-
- if (typeof(hour) == 'object') {
- hour = false;
- }
- if (typeof(minute) == 'object') {
- minute = false;
- }
- if (typeof(second) == 'object') {
- second = false;
- }
- if (typeof(millisec) == 'object') {
- millisec = false;
- }
- if (typeof(timezone) == 'object') {
- timezone = false;
- }
-
- if (hour !== false) {
- hour = parseInt(hour, 10);
- }
- if (minute !== false) {
- minute = parseInt(minute, 10);
- }
- if (second !== false) {
- second = parseInt(second, 10);
- }
- if (millisec !== false) {
- millisec = parseInt(millisec, 10);
- }
-
- var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
-
- // If the update was done in the input field, the input field should not be updated.
- // If the update was done using the sliders, update the input field.
- var hasChanged = (hour != this.hour || minute != this.minute || second != this.second || millisec != this.millisec
- || (this.ampm.length > 0 && (hour < 12) != ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1))
- || ((this.timezone === null && timezone != this.defaultTimezone) || (this.timezone !== null && timezone != this.timezone)));
-
- if (hasChanged) {
-
- if (hour !== false) {
- this.hour = hour;
- }
- if (minute !== false) {
- this.minute = minute;
- }
- if (second !== false) {
- this.second = second;
- }
- if (millisec !== false) {
- this.millisec = millisec;
- }
- if (timezone !== false) {
- this.timezone = timezone;
- }
-
- if (!this.inst) {
- this.inst = $.datepicker._getInst(this.$input[0]);
- }
-
- this._limitMinMaxDateTime(this.inst, true);
- }
- if (useAmpm(o.timeFormat)) {
- this.ampm = ampm;
- }
-
- // Updates the time within the timepicker
- this.formattedTime = $.datepicker.formatTime(o.timeFormat, this, o);
- if (this.$timeObj) {
- if(pickerTimeFormat === o.timeFormat){
- this.$timeObj.text(this.formattedTime + pickerTimeSuffix);
- }
- else{
- this.$timeObj.text($.datepicker.formatTime(pickerTimeFormat, this, o) + pickerTimeSuffix);
- }
- }
-
- this.timeDefined = true;
- if (hasChanged) {
- this._updateDateTime();
- }
- },
-
- /*
- * call custom onSelect.
- * bind to sliders slidestop, and grid click.
- */
- _onSelectHandler: function() {
- var onSelect = this._defaults.onSelect || this.inst.settings.onSelect;
- var inputEl = this.$input ? this.$input[0] : null;
- if (onSelect && inputEl) {
- onSelect.apply(inputEl, [this.formattedDateTime, this]);
- }
- },
-
- /*
- * update our input with the new date time..
- */
- _updateDateTime: function(dp_inst) {
- dp_inst = this.inst || dp_inst;
- var dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
- dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
- formatCfg = $.datepicker._getFormatConfig(dp_inst),
- timeAvailable = dt !== null && this.timeDefined;
- this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
- var formattedDateTime = this.formattedDate;
-
- // if a slider was changed but datepicker doesn't have a value yet, set it
- if(dp_inst.lastVal==""){
- dp_inst.currentYear=dp_inst.selectedYear;
- dp_inst.currentMonth=dp_inst.selectedMonth;
- dp_inst.currentDay=dp_inst.selectedDay;
- }
-
- /*
- * remove following lines to force every changes in date picker to change the input value
- * Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker.
- * If the user manually empty the value in the input field, the date picker will never change selected value.
- */
- //if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) {
- // return;
- //}
-
- if (this._defaults.timeOnly === true) {
- formattedDateTime = this.formattedTime;
- } else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) {
- formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
- }
-
- this.formattedDateTime = formattedDateTime;
-
- if (!this._defaults.showTimepicker) {
- this.$input.val(this.formattedDate);
- } else if (this.$altInput && this._defaults.altFieldTimeOnly === true) {
- this.$altInput.val(this.formattedTime);
- this.$input.val(this.formattedDate);
- } else if (this.$altInput) {
- this.$input.val(formattedDateTime);
- var altFormattedDateTime = '',
- altSeparator = this._defaults.altSeparator ? this._defaults.altSeparator : this._defaults.separator,
- altTimeSuffix = this._defaults.altTimeSuffix ? this._defaults.altTimeSuffix : this._defaults.timeSuffix;
-
- if (this._defaults.altFormat) altFormattedDateTime = $.datepicker.formatDate(this._defaults.altFormat, (dt === null ? new Date() : dt), formatCfg);
- else altFormattedDateTime = this.formattedDate;
- if (altFormattedDateTime) altFormattedDateTime += altSeparator;
- if (this._defaults.altTimeFormat) altFormattedDateTime += $.datepicker.formatTime(this._defaults.altTimeFormat, this, this._defaults) + altTimeSuffix;
- else altFormattedDateTime += this.formattedTime + altTimeSuffix;
- this.$altInput.val(altFormattedDateTime);
- } else {
- this.$input.val(formattedDateTime);
- }
-
- this.$input.trigger("change");
- },
-
- _onFocus: function() {
- if (!this.$input.val() && this._defaults.defaultValue) {
- this.$input.val(this._defaults.defaultValue);
- var inst = $.datepicker._getInst(this.$input.get(0)),
- tp_inst = $.datepicker._get(inst, 'timepicker');
- if (tp_inst) {
- if (tp_inst._defaults.timeOnly && (inst.input.val() != inst.lastVal)) {
- try {
- $.datepicker._updateDatepicker(inst);
- } catch (err) {
- $.timepicker.log(err);
- }
- }
- }
- }
- },
-
- /*
- * Small abstraction to control types
- * We can add more, just be sure to follow the pattern: create, options, value
- */
- _controls: {
- // slider methods
- slider: {
- create: function(tp_inst, obj, unit, val, min, max, step){
- var rtl = tp_inst._defaults.isRTL; // if rtl go -60->0 instead of 0->60
- return obj.prop('slide', null).slider({
- orientation: "horizontal",
- value: rtl? val*-1 : val,
- min: rtl? max*-1 : min,
- max: rtl? min*-1 : max,
- step: step,
- slide: function(event, ui) {
- tp_inst.control.value(tp_inst, $(this), unit, rtl? ui.value*-1:ui.value);
- tp_inst._onTimeChange();
- },
- stop: function(event, ui) {
- tp_inst._onSelectHandler();
- }
- });
- },
- options: function(tp_inst, obj, unit, opts, val){
- if(tp_inst._defaults.isRTL){
- if(typeof(opts) == 'string'){
- if(opts == 'min' || opts == 'max'){
- if(val !== undefined)
- return obj.slider(opts, val*-1);
- return Math.abs(obj.slider(opts));
- }
- return obj.slider(opts);
- }
- var min = opts.min,
- max = opts.max;
- opts.min = opts.max = null;
- if(min !== undefined)
- opts.max = min * -1;
- if(max !== undefined)
- opts.min = max * -1;
- return obj.slider(opts);
- }
- if(typeof(opts) == 'string' && val !== undefined)
- return obj.slider(opts, val);
- return obj.slider(opts);
- },
- value: function(tp_inst, obj, unit, val){
- if(tp_inst._defaults.isRTL){
- if(val !== undefined)
- return obj.slider('value', val*-1);
- return Math.abs(obj.slider('value'));
- }
- if(val !== undefined)
- return obj.slider('value', val);
- return obj.slider('value');
- }
- },
- // select methods
- select: {
- create: function(tp_inst, obj, unit, val, min, max, step){
- var sel = '',
- ul = tp_inst._defaults.timeFormat.indexOf('t') !== -1? 'toLowerCase':'toUpperCase',
- m = 0;
-
- for(var i=min; i<=max; i+=step){
- sel += '';
- if(unit == 'hour' && useAmpm(tp_inst._defaults.pickerTimeFormat || tp_inst._defaults.timeFormat))
- sel += $.datepicker.formatTime("hh TT", {hour:i}, tp_inst._defaults);
- else if(unit == 'millisec' || i >= 10) sel += i;
- else sel += '0'+ i.toString();
- sel += ' ';
- }
- sel += ' ';
-
- obj.children('select').remove();
-
- $(sel).appendTo(obj).change(function(e){
- tp_inst._onTimeChange();
- tp_inst._onSelectHandler();
- });
-
- return obj;
- },
- options: function(tp_inst, obj, unit, opts, val){
- var o = {},
- $t = obj.children('select');
- if(typeof(opts) == 'string'){
- if(val === undefined)
- return $t.data(opts);
- o[opts] = val;
- }
- else o = opts;
- return tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min || $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step'));
- },
- value: function(tp_inst, obj, unit, val){
- var $t = obj.children('select');
- if(val !== undefined)
- return $t.val(val);
- return $t.val();
- }
- }
- } // end _controls
-
- });
-
- $.fn.extend({
- /*
- * shorthand just to use timepicker..
- */
- timepicker: function(o) {
- o = o || {};
- var tmp_args = Array.prototype.slice.call(arguments);
-
- if (typeof o == 'object') {
- tmp_args[0] = $.extend(o, {
- timeOnly: true
- });
- }
-
- return $(this).each(function() {
- $.fn.datetimepicker.apply($(this), tmp_args);
- });
- },
-
- /*
- * extend timepicker to datepicker
- */
- datetimepicker: function(o) {
- o = o || {};
- var tmp_args = arguments;
-
- if (typeof(o) == 'string') {
- if (o == 'getDate') {
- return $.fn.datepicker.apply($(this[0]), tmp_args);
- } else {
- return this.each(function() {
- var $t = $(this);
- $t.datepicker.apply($t, tmp_args);
- });
- }
- } else {
- return this.each(function() {
- var $t = $(this);
- $t.datepicker($.timepicker._newInst($t, o)._defaults);
- });
- }
- }
- });
-
- /*
- * Public Utility to parse date and time
- */
- $.datepicker.parseDateTime = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
- var parseRes = parseDateTimeInternal(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings);
- if (parseRes.timeObj) {
- var t = parseRes.timeObj;
- parseRes.date.setHours(t.hour, t.minute, t.second, t.millisec);
- }
-
- return parseRes.date;
- };
-
- /*
- * Public utility to parse time
- */
- $.datepicker.parseTime = function(timeFormat, timeString, options) {
- var o = extendRemove(extendRemove({}, $.timepicker._defaults), options || {});
-
- // Strict parse requires the timeString to match the timeFormat exactly
- var strictParse = function(f, s, o){
-
- // pattern for standard and localized AM/PM markers
- var getPatternAmpm = function(amNames, pmNames) {
- var markers = [];
- if (amNames) {
- $.merge(markers, amNames);
- }
- if (pmNames) {
- $.merge(markers, pmNames);
- }
- markers = $.map(markers, function(val) {
- return val.replace(/[.*+?|()\[\]{}\\]/g, '\\$&');
- });
- return '(' + markers.join('|') + ')?';
- };
-
- // figure out position of time elements.. cause js cant do named captures
- var getFormatPositions = function(timeFormat) {
- var finds = timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|t{1,2}|z|'.*?')/g),
- orders = {
- h: -1,
- m: -1,
- s: -1,
- l: -1,
- t: -1,
- z: -1
- };
-
- if (finds) {
- for (var i = 0; i < finds.length; i++) {
- if (orders[finds[i].toString().charAt(0)] == -1) {
- orders[finds[i].toString().charAt(0)] = i + 1;
- }
- }
- }
- return orders;
- };
-
- var regstr = '^' + f.toString()
- .replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[lz]|'.*?')/g, function (match) {
- var ml = match.length;
- switch (match.charAt(0).toLowerCase()) {
- case 'h': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
- case 'm': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
- case 's': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
- case 'l': return '(\\d?\\d?\\d)';
- case 'z': return '(z|[-+]\\d\\d:?\\d\\d|\\S+)?';
- case 't': return getPatternAmpm(o.amNames, o.pmNames);
- default: // literal escaped in quotes
- return '(' + match.replace(/\'/g, "").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g, function (m) { return "\\" + m; }) + ')?';
- }
- })
- .replace(/\s/g, '\\s?') +
- o.timeSuffix + '$',
- order = getFormatPositions(f),
- ampm = '',
- treg;
-
- treg = s.match(new RegExp(regstr, 'i'));
-
- var resTime = {
- hour: 0,
- minute: 0,
- second: 0,
- millisec: 0
- };
-
- if (treg) {
- if (order.t !== -1) {
- if (treg[order.t] === undefined || treg[order.t].length === 0) {
- ampm = '';
- resTime.ampm = '';
- } else {
- ampm = $.inArray(treg[order.t].toUpperCase(), o.amNames) !== -1 ? 'AM' : 'PM';
- resTime.ampm = o[ampm == 'AM' ? 'amNames' : 'pmNames'][0];
- }
- }
-
- if (order.h !== -1) {
- if (ampm == 'AM' && treg[order.h] == '12') {
- resTime.hour = 0; // 12am = 0 hour
- } else {
- if (ampm == 'PM' && treg[order.h] != '12') {
- resTime.hour = parseInt(treg[order.h], 10) + 12; // 12pm = 12 hour, any other pm = hour + 12
- } else {
- resTime.hour = Number(treg[order.h]);
- }
- }
- }
-
- if (order.m !== -1) {
- resTime.minute = Number(treg[order.m]);
- }
- if (order.s !== -1) {
- resTime.second = Number(treg[order.s]);
- }
- if (order.l !== -1) {
- resTime.millisec = Number(treg[order.l]);
- }
- if (order.z !== -1 && treg[order.z] !== undefined) {
- var tz = treg[order.z].toUpperCase();
- switch (tz.length) {
- case 1:
- // Z
- tz = o.timezoneIso8601 ? 'Z' : '+0000';
- break;
- case 5:
- // +hhmm
- if (o.timezoneIso8601) {
- tz = tz.substring(1) == '0000' ? 'Z' : tz.substring(0, 3) + ':' + tz.substring(3);
- }
- break;
- case 6:
- // +hh:mm
- if (!o.timezoneIso8601) {
- tz = tz == 'Z' || tz.substring(1) == '00:00' ? '+0000' : tz.replace(/:/, '');
- } else {
- if (tz.substring(1) == '00:00') {
- tz = 'Z';
- }
- }
- break;
- }
- resTime.timezone = tz;
- }
-
-
- return resTime;
- }
- return false;
- };// end strictParse
-
- // First try JS Date, if that fails, use strictParse
- var looseParse = function(f,s,o){
- try{
- var d = new Date('2012-01-01 '+ s);
- if(isNaN(d.getTime())){
- d = new Date('2012-01-01T'+ s);
- if(isNaN(d.getTime())){
- d = new Date('01/01/2012 '+ s);
- if(isNaN(d.getTime())){
- throw "Unable to parse time with native Date: "+ s;
- }
- }
- }
-
- return {
- hour: d.getHours(),
- minute: d.getMinutes(),
- second: d.getSeconds(),
- millisec: d.getMilliseconds(),
- timezone: $.timepicker.timeZoneOffsetString(d)
- };
- }
- catch(err){
- try{
- return strictParse(f,s,o);
- }
- catch(err2){
- $.timepicker.log("Unable to parse \ntimeString: "+ s +"\ntimeFormat: "+ f);
- }
- }
- return false;
- }; // end looseParse
-
- if(typeof o.parse === "function"){
- return o.parse(timeFormat, timeString, o)
- }
- if(o.parse === 'loose'){
- return looseParse(timeFormat, timeString, o);
- }
- return strictParse(timeFormat, timeString, o);
- };
-
- /*
- * Public utility to format the time
- * format = string format of the time
- * time = a {}, not a Date() for timezones
- * options = essentially the regional[].. amNames, pmNames, ampm
- */
- $.datepicker.formatTime = function(format, time, options) {
- options = options || {};
- options = $.extend({}, $.timepicker._defaults, options);
- time = $.extend({
- hour: 0,
- minute: 0,
- second: 0,
- millisec: 0,
- timezone: '+0000'
- }, time);
-
- var tmptime = format,
- ampmName = options.amNames[0],
- hour = parseInt(time.hour, 10);
-
- if (hour > 11) {
- ampmName = options.pmNames[0];
- }
-
- tmptime = tmptime.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[lz]|('.*?'|".*?"))/g, function(match) {
- switch (match) {
- case 'HH':
- return ('0' + hour).slice(-2);
- case 'H':
- return hour;
- case 'hh':
- return ('0' + convert24to12(hour)).slice(-2);
- case 'h':
- return convert24to12(hour);
- case 'mm':
- return ('0' + time.minute).slice(-2);
- case 'm':
- return time.minute;
- case 'ss':
- return ('0' + time.second).slice(-2);
- case 's':
- return time.second;
- case 'l':
- return ('00' + time.millisec).slice(-3);
- case 'z':
- return time.timezone === null? options.defaultTimezone : time.timezone;
- case 'T':
- return ampmName.charAt(0).toUpperCase();
- case 'TT':
- return ampmName.toUpperCase();
- case 't':
- return ampmName.charAt(0).toLowerCase();
- case 'tt':
- return ampmName.toLowerCase();
- default:
- return match.replace(/\'/g, "") || "'";
- }
- });
-
- tmptime = $.trim(tmptime);
- return tmptime;
- };
-
- /*
- * the bad hack :/ override datepicker so it doesnt close on select
- // inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378
- */
- $.datepicker._base_selectDate = $.datepicker._selectDate;
- $.datepicker._selectDate = function(id, dateStr) {
- var inst = this._getInst($(id)[0]),
- tp_inst = this._get(inst, 'timepicker');
-
- if (tp_inst) {
- tp_inst._limitMinMaxDateTime(inst, true);
- inst.inline = inst.stay_open = true;
- //This way the onSelect handler called from calendarpicker get the full dateTime
- this._base_selectDate(id, dateStr);
- inst.inline = inst.stay_open = false;
- this._notifyChange(inst);
- this._updateDatepicker(inst);
- } else {
- this._base_selectDate(id, dateStr);
- }
- };
-
- /*
- * second bad hack :/ override datepicker so it triggers an event when changing the input field
- * and does not redraw the datepicker on every selectDate event
- */
- $.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;
- $.datepicker._updateDatepicker = function(inst) {
-
- // don't popup the datepicker if there is another instance already opened
- var input = inst.input[0];
- if ($.datepicker._curInst && $.datepicker._curInst != inst && $.datepicker._datepickerShowing && $.datepicker._lastInput != input) {
- return;
- }
-
- if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
-
- this._base_updateDatepicker(inst);
-
- // Reload the time control when changing something in the input text field.
- var tp_inst = this._get(inst, 'timepicker');
- if (tp_inst) {
- tp_inst._addTimePicker(inst);
-
-// if (tp_inst._defaults.useLocalTimezone) { //checks daylight saving with the new date.
-// var date = new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay, 12);
-// selectLocalTimeZone(tp_inst, date);
-// tp_inst._onTimeChange();
-// }
- }
- }
- };
-
- /*
- * third bad hack :/ override datepicker so it allows spaces and colon in the input field
- */
- $.datepicker._base_doKeyPress = $.datepicker._doKeyPress;
- $.datepicker._doKeyPress = function(event) {
- var inst = $.datepicker._getInst(event.target),
- tp_inst = $.datepicker._get(inst, 'timepicker');
-
- if (tp_inst) {
- if ($.datepicker._get(inst, 'constrainInput')) {
- var ampm = useAmpm(tp_inst._defaults.timeFormat),
- dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
- datetimeChars = tp_inst._defaults.timeFormat.toString()
- .replace(/[hms]/g, '')
- .replace(/TT/g, ampm ? 'APM' : '')
- .replace(/Tt/g, ampm ? 'AaPpMm' : '')
- .replace(/tT/g, ampm ? 'AaPpMm' : '')
- .replace(/T/g, ampm ? 'AP' : '')
- .replace(/tt/g, ampm ? 'apm' : '')
- .replace(/t/g, ampm ? 'ap' : '') +
- " " + tp_inst._defaults.separator +
- tp_inst._defaults.timeSuffix +
- (tp_inst._defaults.showTimezone ? tp_inst._defaults.timezoneList.join('') : '') +
- (tp_inst._defaults.amNames.join('')) + (tp_inst._defaults.pmNames.join('')) +
- dateChars,
- chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
- return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
- }
- }
-
- return $.datepicker._base_doKeyPress(event);
- };
-
- /*
- * Fourth bad hack :/ override _updateAlternate function used in inline mode to init altField
- */
- $.datepicker._base_updateAlternate = $.datepicker._updateAlternate;
- /* Update any alternate field to synchronise with the main field. */
- $.datepicker._updateAlternate = function(inst) {
- var tp_inst = this._get(inst, 'timepicker');
- if(tp_inst){
- var altField = tp_inst._defaults.altField;
- if (altField) { // update alternate field too
- var altFormat = tp_inst._defaults.altFormat || tp_inst._defaults.dateFormat,
- date = this._getDate(inst),
- formatCfg = $.datepicker._getFormatConfig(inst),
- altFormattedDateTime = '',
- altSeparator = tp_inst._defaults.altSeparator ? tp_inst._defaults.altSeparator : tp_inst._defaults.separator,
- altTimeSuffix = tp_inst._defaults.altTimeSuffix ? tp_inst._defaults.altTimeSuffix : tp_inst._defaults.timeSuffix,
- altTimeFormat = tp_inst._defaults.altTimeFormat !== null ? tp_inst._defaults.altTimeFormat : tp_inst._defaults.timeFormat;
-
- altFormattedDateTime += $.datepicker.formatTime(altTimeFormat, tp_inst, tp_inst._defaults) + altTimeSuffix;
- if(!tp_inst._defaults.timeOnly && !tp_inst._defaults.altFieldTimeOnly && date !== null){
- if(tp_inst._defaults.altFormat)
- altFormattedDateTime = $.datepicker.formatDate(tp_inst._defaults.altFormat, date, formatCfg) + altSeparator + altFormattedDateTime;
- else altFormattedDateTime = tp_inst.formattedDate + altSeparator + altFormattedDateTime;
- }
- $(altField).val(altFormattedDateTime);
- }
- }
- else{
- $.datepicker._base_updateAlternate(inst);
- }
- };
-
- /*
- * Override key up event to sync manual input changes.
- */
- $.datepicker._base_doKeyUp = $.datepicker._doKeyUp;
- $.datepicker._doKeyUp = function(event) {
- var inst = $.datepicker._getInst(event.target),
- tp_inst = $.datepicker._get(inst, 'timepicker');
-
- if (tp_inst) {
- if (tp_inst._defaults.timeOnly && (inst.input.val() != inst.lastVal)) {
- try {
- $.datepicker._updateDatepicker(inst);
- } catch (err) {
- $.timepicker.log(err);
- }
- }
- }
-
- return $.datepicker._base_doKeyUp(event);
- };
-
- /*
- * override "Today" button to also grab the time.
- */
- $.datepicker._base_gotoToday = $.datepicker._gotoToday;
- $.datepicker._gotoToday = function(id) {
- var inst = this._getInst($(id)[0]),
- $dp = inst.dpDiv;
- this._base_gotoToday(id);
- var tp_inst = this._get(inst, 'timepicker');
- selectLocalTimeZone(tp_inst);
- var now = new Date();
- this._setTime(inst, now);
- $('.ui-datepicker-today', $dp).click();
- };
-
- /*
- * Disable & enable the Time in the datetimepicker
- */
- $.datepicker._disableTimepickerDatepicker = function(target) {
- var inst = this._getInst(target);
- if (!inst) {
- return;
- }
-
- var tp_inst = this._get(inst, 'timepicker');
- $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
- if (tp_inst) {
- tp_inst._defaults.showTimepicker = false;
- tp_inst._updateDateTime(inst);
- }
- };
-
- $.datepicker._enableTimepickerDatepicker = function(target) {
- var inst = this._getInst(target);
- if (!inst) {
- return;
- }
-
- var tp_inst = this._get(inst, 'timepicker');
- $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
- if (tp_inst) {
- tp_inst._defaults.showTimepicker = true;
- tp_inst._addTimePicker(inst); // Could be disabled on page load
- tp_inst._updateDateTime(inst);
- }
- };
-
- /*
- * Create our own set time function
- */
- $.datepicker._setTime = function(inst, date) {
- var tp_inst = this._get(inst, 'timepicker');
- if (tp_inst) {
- var defaults = tp_inst._defaults;
-
- // calling _setTime with no date sets time to defaults
- tp_inst.hour = date ? date.getHours() : defaults.hour;
- tp_inst.minute = date ? date.getMinutes() : defaults.minute;
- tp_inst.second = date ? date.getSeconds() : defaults.second;
- tp_inst.millisec = date ? date.getMilliseconds() : defaults.millisec;
-
- //check if within min/max times..
- tp_inst._limitMinMaxDateTime(inst, true);
-
- tp_inst._onTimeChange();
- tp_inst._updateDateTime(inst);
- }
- };
-
- /*
- * Create new public method to set only time, callable as $().datepicker('setTime', date)
- */
- $.datepicker._setTimeDatepicker = function(target, date, withDate) {
- var inst = this._getInst(target);
- if (!inst) {
- return;
- }
-
- var tp_inst = this._get(inst, 'timepicker');
-
- if (tp_inst) {
- this._setDateFromField(inst);
- var tp_date;
- if (date) {
- if (typeof date == "string") {
- tp_inst._parseTime(date, withDate);
- tp_date = new Date();
- tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
- } else {
- tp_date = new Date(date.getTime());
- }
- if (tp_date.toString() == 'Invalid Date') {
- tp_date = undefined;
- }
- this._setTime(inst, tp_date);
- }
- }
-
- };
-
- /*
- * override setDate() to allow setting time too within Date object
- */
- $.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
- $.datepicker._setDateDatepicker = function(target, date) {
- var inst = this._getInst(target);
- if (!inst) {
- return;
- }
-
- var tp_date = (date instanceof Date) ? new Date(date.getTime()) : date;
-
- this._updateDatepicker(inst);
- this._base_setDateDatepicker.apply(this, arguments);
- this._setTimeDatepicker(target, tp_date, true);
- };
-
- /*
- * override getDate() to allow getting time too within Date object
- */
- $.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;
- $.datepicker._getDateDatepicker = function(target, noDefault) {
- var inst = this._getInst(target);
- if (!inst) {
- return;
- }
-
- var tp_inst = this._get(inst, 'timepicker');
-
- if (tp_inst) {
- // if it hasn't yet been defined, grab from field
- if(inst.lastVal === undefined){
- this._setDateFromField(inst, noDefault);
- }
-
- var date = this._getDate(inst);
- if (date && tp_inst._parseTime($(target).val(), tp_inst.timeOnly)) {
- date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
- }
- return date;
- }
- return this._base_getDateDatepicker(target, noDefault);
- };
-
- /*
- * override parseDate() because UI 1.8.14 throws an error about "Extra characters"
- * An option in datapicker to ignore extra format characters would be nicer.
- */
- $.datepicker._base_parseDate = $.datepicker.parseDate;
- $.datepicker.parseDate = function(format, value, settings) {
- var date;
- try {
- date = this._base_parseDate(format, value, settings);
- } catch (err) {
- // Hack! The error message ends with a colon, a space, and
- // the "extra" characters. We rely on that instead of
- // attempting to perfectly reproduce the parsing algorithm.
- date = this._base_parseDate(format, value.substring(0,value.length-(err.length-err.indexOf(':')-2)), settings);
- $.timepicker.log("Error parsing the date string: " + err + "\ndate string = " + value + "\ndate format = " + format);
- }
- return date;
- };
-
- /*
- * override formatDate to set date with time to the input
- */
- $.datepicker._base_formatDate = $.datepicker._formatDate;
- $.datepicker._formatDate = function(inst, day, month, year) {
- var tp_inst = this._get(inst, 'timepicker');
- if (tp_inst) {
- tp_inst._updateDateTime(inst);
- return tp_inst.$input.val();
- }
- return this._base_formatDate(inst);
- };
-
- /*
- * override options setter to add time to maxDate(Time) and minDate(Time). MaxDate
- */
- $.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;
- $.datepicker._optionDatepicker = function(target, name, value) {
- var inst = this._getInst(target),
- name_clone;
- if (!inst) {
- return null;
- }
-
- var tp_inst = this._get(inst, 'timepicker');
- if (tp_inst) {
- var min = null,
- max = null,
- onselect = null,
- overrides = tp_inst._defaults.evnts,
- fns = {},
- prop;
- if (typeof name == 'string') { // if min/max was set with the string
- if (name === 'minDate' || name === 'minDateTime') {
- min = value;
- } else if (name === 'maxDate' || name === 'maxDateTime') {
- max = value;
- } else if (name === 'onSelect') {
- onselect = value;
- } else if (overrides.hasOwnProperty(name)) {
- if (typeof (value) === 'undefined') {
- return overrides[name];
- }
- fns[name] = value;
- name_clone = {}; //empty results in exiting function after overrides updated
- }
- } else if (typeof name == 'object') { //if min/max was set with the JSON
- if (name.minDate) {
- min = name.minDate;
- } else if (name.minDateTime) {
- min = name.minDateTime;
- } else if (name.maxDate) {
- max = name.maxDate;
- } else if (name.maxDateTime) {
- max = name.maxDateTime;
- }
- for (prop in overrides) {
- if (overrides.hasOwnProperty(prop) && name[prop]) {
- fns[prop] = name[prop];
- }
- }
- }
- for (prop in fns) {
- if (fns.hasOwnProperty(prop)) {
- overrides[prop] = fns[prop];
- if (!name_clone) { name_clone = $.extend({}, name);}
- delete name_clone[prop];
- }
- }
- if (name_clone && isEmptyObject(name_clone)) { return; }
- if (min) { //if min was set
- if (min === 0) {
- min = new Date();
- } else {
- min = new Date(min);
- }
- tp_inst._defaults.minDate = min;
- tp_inst._defaults.minDateTime = min;
- } else if (max) { //if max was set
- if (max === 0) {
- max = new Date();
- } else {
- max = new Date(max);
- }
- tp_inst._defaults.maxDate = max;
- tp_inst._defaults.maxDateTime = max;
- } else if (onselect) {
- tp_inst._defaults.onSelect = onselect;
- }
- }
- if (value === undefined) {
- return this._base_optionDatepicker.call($.datepicker, target, name);
- }
- return this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
- };
- /*
- * jQuery isEmptyObject does not check hasOwnProperty - if someone has added to the object prototype,
- * it will return false for all objects
- */
- var isEmptyObject = function(obj) {
- var prop;
- for (prop in obj) {
- if (obj.hasOwnProperty(obj)) {
- return false;
- }
- }
- return true;
- };
-
- /*
- * jQuery extend now ignores nulls!
- */
- var extendRemove = function(target, props) {
- $.extend(target, props);
- for (var name in props) {
- if (props[name] === null || props[name] === undefined) {
- target[name] = props[name];
- }
- }
- return target;
- };
-
- /*
- * Determine by the time format if should use ampm
- * Returns true if should use ampm, false if not
- */
- var useAmpm = function(timeFormat){
- return (timeFormat.indexOf('t') !== -1 && timeFormat.indexOf('h') !== -1);
- };
-
- /*
- * Converts 24 hour format into 12 hour
- * Returns 12 hour without leading 0
- */
- var convert24to12 = function(hour) {
- if (hour > 12) {
- hour = hour - 12;
- }
-
- if (hour == 0) {
- hour = 12;
- }
-
- return String(hour);
- };
-
- /*
- * Splits datetime string into date ans time substrings.
- * Throws exception when date can't be parsed
- * Returns [dateString, timeString]
- */
- var splitDateTime = function(dateFormat, dateTimeString, dateSettings, timeSettings) {
- try {
- // The idea is to get the number separator occurances in datetime and the time format requested (since time has
- // fewer unknowns, mostly numbers and am/pm). We will use the time pattern to split.
- var separator = timeSettings && timeSettings.separator ? timeSettings.separator : $.timepicker._defaults.separator,
- format = timeSettings && timeSettings.timeFormat ? timeSettings.timeFormat : $.timepicker._defaults.timeFormat,
- timeParts = format.split(separator), // how many occurances of separator may be in our format?
- timePartsLen = timeParts.length,
- allParts = dateTimeString.split(separator),
- allPartsLen = allParts.length;
-
- if (allPartsLen > 1) {
- return [
- allParts.splice(0,allPartsLen-timePartsLen).join(separator),
- allParts.splice(0,timePartsLen).join(separator)
- ];
- }
-
- } catch (err) {
- $.timepicker.log('Could not split the date from the time. Please check the following datetimepicker options' +
- "\nthrown error: " + err +
- "\ndateTimeString" + dateTimeString +
- "\ndateFormat = " + dateFormat +
- "\nseparator = " + timeSettings.separator +
- "\ntimeFormat = " + timeSettings.timeFormat);
-
- if (err.indexOf(":") >= 0) {
- // Hack! The error message ends with a colon, a space, and
- // the "extra" characters. We rely on that instead of
- // attempting to perfectly reproduce the parsing algorithm.
- var dateStringLength = dateTimeString.length - (err.length - err.indexOf(':') - 2),
- timeString = dateTimeString.substring(dateStringLength);
-
- return [$.trim(dateTimeString.substring(0, dateStringLength)), $.trim(dateTimeString.substring(dateStringLength))];
-
- } else {
- throw err;
- }
- }
- return [dateTimeString, ''];
- };
-
- /*
- * Internal function to parse datetime interval
- * Returns: {date: Date, timeObj: Object}, where
- * date - parsed date without time (type Date)
- * timeObj = {hour: , minute: , second: , millisec: } - parsed time. Optional
- */
- var parseDateTimeInternal = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
- var date;
- var splitRes = splitDateTime(dateFormat, dateTimeString, dateSettings, timeSettings);
- date = $.datepicker._base_parseDate(dateFormat, splitRes[0], dateSettings);
- if (splitRes[1] !== '') {
- var timeString = splitRes[1],
- parsedTime = $.datepicker.parseTime(timeFormat, timeString, timeSettings);
-
- if (parsedTime === null) {
- throw 'Wrong time format';
- }
- return {
- date: date,
- timeObj: parsedTime
- };
- } else {
- return {
- date: date
- };
- }
- };
-
- /*
- * Internal function to set timezone_select to the local timezone
- */
- var selectLocalTimeZone = function(tp_inst, date) {
- if (tp_inst && tp_inst.timezone_select) {
- tp_inst._defaults.useLocalTimezone = true;
- var now = typeof date !== 'undefined' ? date : new Date();
- var tzoffset = $.timepicker.timeZoneOffsetString(now);
- if (tp_inst._defaults.timezoneIso8601) {
- tzoffset = tzoffset.substring(0, 3) + ':' + tzoffset.substring(3);
- }
- tp_inst.timezone_select.val(tzoffset);
- }
- };
-
- /*
- * Create a Singleton Insance
- */
- $.timepicker = new Timepicker();
-
- /**
- * Get the timezone offset as string from a date object (eg '+0530' for UTC+5.5)
- * @param date
- * @return string
- */
- $.timepicker.timeZoneOffsetString = function(date) {
- var off = date.getTimezoneOffset() * -1,
- minutes = off % 60,
- hours = (off - minutes) / 60;
- return (off >= 0 ? '+' : '-') + ('0' + (hours * 101).toString()).slice(-2) + ('0' + (minutes * 101).toString()).slice(-2);
- };
-
- /**
- * Calls `timepicker()` on the `startTime` and `endTime` elements, and configures them to
- * enforce date range limits.
- * n.b. The input value must be correctly formatted (reformatting is not supported)
- * @param Element startTime
- * @param Element endTime
- * @param obj options Options for the timepicker() call
- * @return jQuery
- */
- $.timepicker.timeRange = function(startTime, endTime, options) {
- return $.timepicker.handleRange('timepicker', startTime, endTime, options);
- };
-
- /**
- * Calls `datetimepicker` on the `startTime` and `endTime` elements, and configures them to
- * enforce date range limits.
- * @param Element startTime
- * @param Element endTime
- * @param obj options Options for the `timepicker()` call. Also supports `reformat`,
- * a boolean value that can be used to reformat the input values to the `dateFormat`.
- * @param string method Can be used to specify the type of picker to be added
- * @return jQuery
- */
- $.timepicker.dateTimeRange = function(startTime, endTime, options) {
- $.timepicker.dateRange(startTime, endTime, options, 'datetimepicker');
- };
-
- /**
- * Calls `method` on the `startTime` and `endTime` elements, and configures them to
- * enforce date range limits.
- * @param Element startTime
- * @param Element endTime
- * @param obj options Options for the `timepicker()` call. Also supports `reformat`,
- * a boolean value that can be used to reformat the input values to the `dateFormat`.
- * @param string method Can be used to specify the type of picker to be added
- * @return jQuery
- */
- $.timepicker.dateRange = function(startTime, endTime, options, method) {
- method = method || 'datepicker';
- $.timepicker.handleRange(method, startTime, endTime, options);
- };
-
- /**
- * Calls `method` on the `startTime` and `endTime` elements, and configures them to
- * enforce date range limits.
- * @param string method Can be used to specify the type of picker to be added
- * @param Element startTime
- * @param Element endTime
- * @param obj options Options for the `timepicker()` call. Also supports `reformat`,
- * a boolean value that can be used to reformat the input values to the `dateFormat`.
- * @return jQuery
- */
- $.timepicker.handleRange = function(method, startTime, endTime, options) {
- $.fn[method].call(startTime, $.extend({
- onClose: function(dateText, inst) {
- checkDates(this, endTime, dateText);
- },
- onSelect: function(selectedDateTime) {
- selected(this, endTime, 'minDate');
- }
- }, options, options.start));
- $.fn[method].call(endTime, $.extend({
- onClose: function(dateText, inst) {
- checkDates(this, startTime, dateText);
- },
- onSelect: function(selectedDateTime) {
- selected(this, startTime, 'maxDate');
- }
- }, options, options.end));
- // timepicker doesn't provide access to its 'timeFormat' option,
- // nor could I get datepicker.formatTime() to behave with times, so I
- // have disabled reformatting for timepicker
- if (method != 'timepicker' && options.reformat) {
- $([startTime, endTime]).each(function() {
- var format = $(this)[method].call($(this), 'option', 'dateFormat'),
- date = new Date($(this).val());
- if ($(this).val() && date) {
- $(this).val($.datepicker.formatDate(format, date));
- }
- });
- }
- checkDates(startTime, endTime, startTime.val());
-
- function checkDates(changed, other, dateText) {
- if (other.val() && (new Date(startTime.val()) > new Date(endTime.val()))) {
- other.val(dateText);
- }
- }
- selected(startTime, endTime, 'minDate');
- selected(endTime, startTime, 'maxDate');
-
- function selected(changed, other, option) {
- if (!$(changed).val()) {
- return;
- }
- var date = $(changed)[method].call($(changed), 'getDate');
- // timepicker doesn't implement 'getDate' and returns a jQuery
- if (date.getTime) {
- $(other)[method].call($(other), 'option', option, date);
- }
- }
- return $([startTime.get(0), endTime.get(0)]);
- };
-
- /**
- * Log error or data to the console during error or debugging
- * @param Object err pass any type object to log to the console during error or debugging
- * @return void
- */
- $.timepicker.log = function(err){
- if(window.console)
- console.log(err);
- };
-
- /*
- * Keep up with the version
- */
- $.timepicker.version = "1.2";
-
-})(jQuery);
diff --git a/jquery-ui-timepicker-addon.json b/jquery-ui-timepicker-addon.json
new file mode 100644
index 0000000..6d41321
--- /dev/null
+++ b/jquery-ui-timepicker-addon.json
@@ -0,0 +1,28 @@
+{
+ "name": "jquery-ui-timepicker-addon",
+ "title": "jQuery Timepicker Addon",
+ "description": "A timepicker addon for jQueryUI datepicker.",
+ "version": "1.6.3",
+ "modified": "2016-04-20",
+ "homepage": "http://trentrichardson.com/examples/timepicker",
+ "author": {
+ "name": "Trent Richardson",
+ "email": "trentdrichardson@gmail.com",
+ "url": "http://trentrichardson.com"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/trentrichardson/jQuery-Timepicker-Addon.git"
+ },
+ "bugs": "https://github.com/trentrichardson/jQuery-Timepicker-Addon/issues",
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "http://trentrichardson.com/examples/jQuery-Timepicker-Addon/blob/master/LICENSE-MIT"
+ }
+ ],
+ "dependencies": {
+ "jquery": "*"
+ },
+ "keywords": []
+}
diff --git a/lib/jasmine-1.3.1/MIT.LICENSE b/lib/jasmine-1.3.1/MIT.LICENSE
new file mode 100644
index 0000000..7c435ba
--- /dev/null
+++ b/lib/jasmine-1.3.1/MIT.LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2008-2011 Pivotal Labs
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/lib/jasmine-1.3.1/jasmine-html.js b/lib/jasmine-1.3.1/jasmine-html.js
new file mode 100644
index 0000000..543d569
--- /dev/null
+++ b/lib/jasmine-1.3.1/jasmine-html.js
@@ -0,0 +1,681 @@
+jasmine.HtmlReporterHelpers = {};
+
+jasmine.HtmlReporterHelpers.createDom = function(type, attrs, childrenVarArgs) {
+ var el = document.createElement(type);
+
+ for (var i = 2; i < arguments.length; i++) {
+ var child = arguments[i];
+
+ if (typeof child === 'string') {
+ el.appendChild(document.createTextNode(child));
+ } else {
+ if (child) {
+ el.appendChild(child);
+ }
+ }
+ }
+
+ for (var attr in attrs) {
+ if (attr == "className") {
+ el[attr] = attrs[attr];
+ } else {
+ el.setAttribute(attr, attrs[attr]);
+ }
+ }
+
+ return el;
+};
+
+jasmine.HtmlReporterHelpers.getSpecStatus = function(child) {
+ var results = child.results();
+ var status = results.passed() ? 'passed' : 'failed';
+ if (results.skipped) {
+ status = 'skipped';
+ }
+
+ return status;
+};
+
+jasmine.HtmlReporterHelpers.appendToSummary = function(child, childElement) {
+ var parentDiv = this.dom.summary;
+ var parentSuite = (typeof child.parentSuite == 'undefined') ? 'suite' : 'parentSuite';
+ var parent = child[parentSuite];
+
+ if (parent) {
+ if (typeof this.views.suites[parent.id] == 'undefined') {
+ this.views.suites[parent.id] = new jasmine.HtmlReporter.SuiteView(parent, this.dom, this.views);
+ }
+ parentDiv = this.views.suites[parent.id].element;
+ }
+
+ parentDiv.appendChild(childElement);
+};
+
+
+jasmine.HtmlReporterHelpers.addHelpers = function(ctor) {
+ for(var fn in jasmine.HtmlReporterHelpers) {
+ ctor.prototype[fn] = jasmine.HtmlReporterHelpers[fn];
+ }
+};
+
+jasmine.HtmlReporter = function(_doc) {
+ var self = this;
+ var doc = _doc || window.document;
+
+ var reporterView;
+
+ var dom = {};
+
+ // Jasmine Reporter Public Interface
+ self.logRunningSpecs = false;
+
+ self.reportRunnerStarting = function(runner) {
+ var specs = runner.specs() || [];
+
+ if (specs.length == 0) {
+ return;
+ }
+
+ createReporterDom(runner.env.versionString());
+ doc.body.appendChild(dom.reporter);
+ setExceptionHandling();
+
+ reporterView = new jasmine.HtmlReporter.ReporterView(dom);
+ reporterView.addSpecs(specs, self.specFilter);
+ };
+
+ self.reportRunnerResults = function(runner) {
+ reporterView && reporterView.complete();
+ };
+
+ self.reportSuiteResults = function(suite) {
+ reporterView.suiteComplete(suite);
+ };
+
+ self.reportSpecStarting = function(spec) {
+ if (self.logRunningSpecs) {
+ self.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
+ }
+ };
+
+ self.reportSpecResults = function(spec) {
+ reporterView.specComplete(spec);
+ };
+
+ self.log = function() {
+ var console = jasmine.getGlobal().console;
+ if (console && console.log) {
+ if (console.log.apply) {
+ console.log.apply(console, arguments);
+ } else {
+ console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
+ }
+ }
+ };
+
+ self.specFilter = function(spec) {
+ if (!focusedSpecName()) {
+ return true;
+ }
+
+ return spec.getFullName().indexOf(focusedSpecName()) === 0;
+ };
+
+ return self;
+
+ function focusedSpecName() {
+ var specName;
+
+ (function memoizeFocusedSpec() {
+ if (specName) {
+ return;
+ }
+
+ var paramMap = [];
+ var params = jasmine.HtmlReporter.parameters(doc);
+
+ for (var i = 0; i < params.length; i++) {
+ var p = params[i].split('=');
+ paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
+ }
+
+ specName = paramMap.spec;
+ })();
+
+ return specName;
+ }
+
+ function createReporterDom(version) {
+ dom.reporter = self.createDom('div', { id: 'HTMLReporter', className: 'jasmine_reporter' },
+ dom.banner = self.createDom('div', { className: 'banner' },
+ self.createDom('span', { className: 'title' }, "Jasmine "),
+ self.createDom('span', { className: 'version' }, version)),
+
+ dom.symbolSummary = self.createDom('ul', {className: 'symbolSummary'}),
+ dom.alert = self.createDom('div', {className: 'alert'},
+ self.createDom('span', { className: 'exceptions' },
+ self.createDom('label', { className: 'label', 'for': 'no_try_catch' }, 'No try/catch'),
+ self.createDom('input', { id: 'no_try_catch', type: 'checkbox' }))),
+ dom.results = self.createDom('div', {className: 'results'},
+ dom.summary = self.createDom('div', { className: 'summary' }),
+ dom.details = self.createDom('div', { id: 'details' }))
+ );
+ }
+
+ function noTryCatch() {
+ return window.location.search.match(/catch=false/);
+ }
+
+ function searchWithCatch() {
+ var params = jasmine.HtmlReporter.parameters(window.document);
+ var removed = false;
+ var i = 0;
+
+ while (!removed && i < params.length) {
+ if (params[i].match(/catch=/)) {
+ params.splice(i, 1);
+ removed = true;
+ }
+ i++;
+ }
+ if (jasmine.CATCH_EXCEPTIONS) {
+ params.push("catch=false");
+ }
+
+ return params.join("&");
+ }
+
+ function setExceptionHandling() {
+ var chxCatch = document.getElementById('no_try_catch');
+
+ if (noTryCatch()) {
+ chxCatch.setAttribute('checked', true);
+ jasmine.CATCH_EXCEPTIONS = false;
+ }
+ chxCatch.onclick = function() {
+ window.location.search = searchWithCatch();
+ };
+ }
+};
+jasmine.HtmlReporter.parameters = function(doc) {
+ var paramStr = doc.location.search.substring(1);
+ var params = [];
+
+ if (paramStr.length > 0) {
+ params = paramStr.split('&');
+ }
+ return params;
+}
+jasmine.HtmlReporter.sectionLink = function(sectionName) {
+ var link = '?';
+ var params = [];
+
+ if (sectionName) {
+ params.push('spec=' + encodeURIComponent(sectionName));
+ }
+ if (!jasmine.CATCH_EXCEPTIONS) {
+ params.push("catch=false");
+ }
+ if (params.length > 0) {
+ link += params.join("&");
+ }
+
+ return link;
+};
+jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter);
+jasmine.HtmlReporter.ReporterView = function(dom) {
+ this.startedAt = new Date();
+ this.runningSpecCount = 0;
+ this.completeSpecCount = 0;
+ this.passedCount = 0;
+ this.failedCount = 0;
+ this.skippedCount = 0;
+
+ this.createResultsMenu = function() {
+ this.resultsMenu = this.createDom('span', {className: 'resultsMenu bar'},
+ this.summaryMenuItem = this.createDom('a', {className: 'summaryMenuItem', href: "#"}, '0 specs'),
+ ' | ',
+ this.detailsMenuItem = this.createDom('a', {className: 'detailsMenuItem', href: "#"}, '0 failing'));
+
+ this.summaryMenuItem.onclick = function() {
+ dom.reporter.className = dom.reporter.className.replace(/ showDetails/g, '');
+ };
+
+ this.detailsMenuItem.onclick = function() {
+ showDetails();
+ };
+ };
+
+ this.addSpecs = function(specs, specFilter) {
+ this.totalSpecCount = specs.length;
+
+ this.views = {
+ specs: {},
+ suites: {}
+ };
+
+ for (var i = 0; i < specs.length; i++) {
+ var spec = specs[i];
+ this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom, this.views);
+ if (specFilter(spec)) {
+ this.runningSpecCount++;
+ }
+ }
+ };
+
+ this.specComplete = function(spec) {
+ this.completeSpecCount++;
+
+ if (isUndefined(this.views.specs[spec.id])) {
+ this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom);
+ }
+
+ var specView = this.views.specs[spec.id];
+
+ switch (specView.status()) {
+ case 'passed':
+ this.passedCount++;
+ break;
+
+ case 'failed':
+ this.failedCount++;
+ break;
+
+ case 'skipped':
+ this.skippedCount++;
+ break;
+ }
+
+ specView.refresh();
+ this.refresh();
+ };
+
+ this.suiteComplete = function(suite) {
+ var suiteView = this.views.suites[suite.id];
+ if (isUndefined(suiteView)) {
+ return;
+ }
+ suiteView.refresh();
+ };
+
+ this.refresh = function() {
+
+ if (isUndefined(this.resultsMenu)) {
+ this.createResultsMenu();
+ }
+
+ // currently running UI
+ if (isUndefined(this.runningAlert)) {
+ this.runningAlert = this.createDom('a', { href: jasmine.HtmlReporter.sectionLink(), className: "runningAlert bar" });
+ dom.alert.appendChild(this.runningAlert);
+ }
+ this.runningAlert.innerHTML = "Running " + this.completeSpecCount + " of " + specPluralizedFor(this.totalSpecCount);
+
+ // skipped specs UI
+ if (isUndefined(this.skippedAlert)) {
+ this.skippedAlert = this.createDom('a', { href: jasmine.HtmlReporter.sectionLink(), className: "skippedAlert bar" });
+ }
+
+ this.skippedAlert.innerHTML = "Skipping " + this.skippedCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";
+
+ if (this.skippedCount === 1 && isDefined(dom.alert)) {
+ dom.alert.appendChild(this.skippedAlert);
+ }
+
+ // passing specs UI
+ if (isUndefined(this.passedAlert)) {
+ this.passedAlert = this.createDom('span', { href: jasmine.HtmlReporter.sectionLink(), className: "passingAlert bar" });
+ }
+ this.passedAlert.innerHTML = "Passing " + specPluralizedFor(this.passedCount);
+
+ // failing specs UI
+ if (isUndefined(this.failedAlert)) {
+ this.failedAlert = this.createDom('span', {href: "?", className: "failingAlert bar"});
+ }
+ this.failedAlert.innerHTML = "Failing " + specPluralizedFor(this.failedCount);
+
+ if (this.failedCount === 1 && isDefined(dom.alert)) {
+ dom.alert.appendChild(this.failedAlert);
+ dom.alert.appendChild(this.resultsMenu);
+ }
+
+ // summary info
+ this.summaryMenuItem.innerHTML = "" + specPluralizedFor(this.runningSpecCount);
+ this.detailsMenuItem.innerHTML = "" + this.failedCount + " failing";
+ };
+
+ this.complete = function() {
+ dom.alert.removeChild(this.runningAlert);
+
+ this.skippedAlert.innerHTML = "Ran " + this.runningSpecCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";
+
+ if (this.failedCount === 0) {
+ dom.alert.appendChild(this.createDom('span', {className: 'passingAlert bar'}, "Passing " + specPluralizedFor(this.passedCount)));
+ } else {
+ showDetails();
+ }
+
+ dom.banner.appendChild(this.createDom('span', {className: 'duration'}, "finished in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"));
+ };
+
+ return this;
+
+ function showDetails() {
+ if (dom.reporter.className.search(/showDetails/) === -1) {
+ dom.reporter.className += " showDetails";
+ }
+ }
+
+ function isUndefined(obj) {
+ return typeof obj === 'undefined';
+ }
+
+ function isDefined(obj) {
+ return !isUndefined(obj);
+ }
+
+ function specPluralizedFor(count) {
+ var str = count + " spec";
+ if (count > 1) {
+ str += "s"
+ }
+ return str;
+ }
+
+};
+
+jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.ReporterView);
+
+
+jasmine.HtmlReporter.SpecView = function(spec, dom, views) {
+ this.spec = spec;
+ this.dom = dom;
+ this.views = views;
+
+ this.symbol = this.createDom('li', { className: 'pending' });
+ this.dom.symbolSummary.appendChild(this.symbol);
+
+ this.summary = this.createDom('div', { className: 'specSummary' },
+ this.createDom('a', {
+ className: 'description',
+ href: jasmine.HtmlReporter.sectionLink(this.spec.getFullName()),
+ title: this.spec.getFullName()
+ }, this.spec.description)
+ );
+
+ this.detail = this.createDom('div', { className: 'specDetail' },
+ this.createDom('a', {
+ className: 'description',
+ href: '?spec=' + encodeURIComponent(this.spec.getFullName()),
+ title: this.spec.getFullName()
+ }, this.spec.getFullName())
+ );
+};
+
+jasmine.HtmlReporter.SpecView.prototype.status = function() {
+ return this.getSpecStatus(this.spec);
+};
+
+jasmine.HtmlReporter.SpecView.prototype.refresh = function() {
+ this.symbol.className = this.status();
+
+ switch (this.status()) {
+ case 'skipped':
+ break;
+
+ case 'passed':
+ this.appendSummaryToSuiteDiv();
+ break;
+
+ case 'failed':
+ this.appendSummaryToSuiteDiv();
+ this.appendFailureDetail();
+ break;
+ }
+};
+
+jasmine.HtmlReporter.SpecView.prototype.appendSummaryToSuiteDiv = function() {
+ this.summary.className += ' ' + this.status();
+ this.appendToSummary(this.spec, this.summary);
+};
+
+jasmine.HtmlReporter.SpecView.prototype.appendFailureDetail = function() {
+ this.detail.className += ' ' + this.status();
+
+ var resultItems = this.spec.results().getItems();
+ var messagesDiv = this.createDom('div', { className: 'messages' });
+
+ for (var i = 0; i < resultItems.length; i++) {
+ var result = resultItems[i];
+
+ if (result.type == 'log') {
+ messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
+ } else if (result.type == 'expect' && result.passed && !result.passed()) {
+ messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
+
+ if (result.trace.stack) {
+ messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
+ }
+ }
+ }
+
+ if (messagesDiv.childNodes.length > 0) {
+ this.detail.appendChild(messagesDiv);
+ this.dom.details.appendChild(this.detail);
+ }
+};
+
+jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SpecView);jasmine.HtmlReporter.SuiteView = function(suite, dom, views) {
+ this.suite = suite;
+ this.dom = dom;
+ this.views = views;
+
+ this.element = this.createDom('div', { className: 'suite' },
+ this.createDom('a', { className: 'description', href: jasmine.HtmlReporter.sectionLink(this.suite.getFullName()) }, this.suite.description)
+ );
+
+ this.appendToSummary(this.suite, this.element);
+};
+
+jasmine.HtmlReporter.SuiteView.prototype.status = function() {
+ return this.getSpecStatus(this.suite);
+};
+
+jasmine.HtmlReporter.SuiteView.prototype.refresh = function() {
+ this.element.className += " " + this.status();
+};
+
+jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SuiteView);
+
+/* @deprecated Use jasmine.HtmlReporter instead
+ */
+jasmine.TrivialReporter = function(doc) {
+ this.document = doc || document;
+ this.suiteDivs = {};
+ this.logRunningSpecs = false;
+};
+
+jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) {
+ var el = document.createElement(type);
+
+ for (var i = 2; i < arguments.length; i++) {
+ var child = arguments[i];
+
+ if (typeof child === 'string') {
+ el.appendChild(document.createTextNode(child));
+ } else {
+ if (child) { el.appendChild(child); }
+ }
+ }
+
+ for (var attr in attrs) {
+ if (attr == "className") {
+ el[attr] = attrs[attr];
+ } else {
+ el.setAttribute(attr, attrs[attr]);
+ }
+ }
+
+ return el;
+};
+
+jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
+ var showPassed, showSkipped;
+
+ this.outerDiv = this.createDom('div', { id: 'TrivialReporter', className: 'jasmine_reporter' },
+ this.createDom('div', { className: 'banner' },
+ this.createDom('div', { className: 'logo' },
+ this.createDom('span', { className: 'title' }, "Jasmine"),
+ this.createDom('span', { className: 'version' }, runner.env.versionString())),
+ this.createDom('div', { className: 'options' },
+ "Show ",
+ showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }),
+ this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "),
+ showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }),
+ this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped")
+ )
+ ),
+
+ this.runnerDiv = this.createDom('div', { className: 'runner running' },
+ this.createDom('a', { className: 'run_spec', href: '?' }, "run all"),
+ this.runnerMessageSpan = this.createDom('span', {}, "Running..."),
+ this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, ""))
+ );
+
+ this.document.body.appendChild(this.outerDiv);
+
+ var suites = runner.suites();
+ for (var i = 0; i < suites.length; i++) {
+ var suite = suites[i];
+ var suiteDiv = this.createDom('div', { className: 'suite' },
+ this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),
+ this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description));
+ this.suiteDivs[suite.id] = suiteDiv;
+ var parentDiv = this.outerDiv;
+ if (suite.parentSuite) {
+ parentDiv = this.suiteDivs[suite.parentSuite.id];
+ }
+ parentDiv.appendChild(suiteDiv);
+ }
+
+ this.startedAt = new Date();
+
+ var self = this;
+ showPassed.onclick = function(evt) {
+ if (showPassed.checked) {
+ self.outerDiv.className += ' show-passed';
+ } else {
+ self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, '');
+ }
+ };
+
+ showSkipped.onclick = function(evt) {
+ if (showSkipped.checked) {
+ self.outerDiv.className += ' show-skipped';
+ } else {
+ self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, '');
+ }
+ };
+};
+
+jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
+ var results = runner.results();
+ var className = (results.failedCount > 0) ? "runner failed" : "runner passed";
+ this.runnerDiv.setAttribute("class", className);
+ //do it twice for IE
+ this.runnerDiv.setAttribute("className", className);
+ var specs = runner.specs();
+ var specCount = 0;
+ for (var i = 0; i < specs.length; i++) {
+ if (this.specFilter(specs[i])) {
+ specCount++;
+ }
+ }
+ var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s");
+ message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s";
+ this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild);
+
+ this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString()));
+};
+
+jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
+ var results = suite.results();
+ var status = results.passed() ? 'passed' : 'failed';
+ if (results.totalCount === 0) { // todo: change this to check results.skipped
+ status = 'skipped';
+ }
+ this.suiteDivs[suite.id].className += " " + status;
+};
+
+jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) {
+ if (this.logRunningSpecs) {
+ this.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
+ }
+};
+
+jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
+ var results = spec.results();
+ var status = results.passed() ? 'passed' : 'failed';
+ if (results.skipped) {
+ status = 'skipped';
+ }
+ var specDiv = this.createDom('div', { className: 'spec ' + status },
+ this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
+ this.createDom('a', {
+ className: 'description',
+ href: '?spec=' + encodeURIComponent(spec.getFullName()),
+ title: spec.getFullName()
+ }, spec.description));
+
+
+ var resultItems = results.getItems();
+ var messagesDiv = this.createDom('div', { className: 'messages' });
+ for (var i = 0; i < resultItems.length; i++) {
+ var result = resultItems[i];
+
+ if (result.type == 'log') {
+ messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
+ } else if (result.type == 'expect' && result.passed && !result.passed()) {
+ messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
+
+ if (result.trace.stack) {
+ messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
+ }
+ }
+ }
+
+ if (messagesDiv.childNodes.length > 0) {
+ specDiv.appendChild(messagesDiv);
+ }
+
+ this.suiteDivs[spec.suite.id].appendChild(specDiv);
+};
+
+jasmine.TrivialReporter.prototype.log = function() {
+ var console = jasmine.getGlobal().console;
+ if (console && console.log) {
+ if (console.log.apply) {
+ console.log.apply(console, arguments);
+ } else {
+ console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
+ }
+ }
+};
+
+jasmine.TrivialReporter.prototype.getLocation = function() {
+ return this.document.location;
+};
+
+jasmine.TrivialReporter.prototype.specFilter = function(spec) {
+ var paramMap = {};
+ var params = this.getLocation().search.substring(1).split('&');
+ for (var i = 0; i < params.length; i++) {
+ var p = params[i].split('=');
+ paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
+ }
+
+ if (!paramMap.spec) {
+ return true;
+ }
+ return spec.getFullName().indexOf(paramMap.spec) === 0;
+};
diff --git a/lib/jasmine-1.3.1/jasmine.css b/lib/jasmine-1.3.1/jasmine.css
new file mode 100644
index 0000000..8c008dc
--- /dev/null
+++ b/lib/jasmine-1.3.1/jasmine.css
@@ -0,0 +1,82 @@
+body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; }
+
+#HTMLReporter { font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; }
+#HTMLReporter a { text-decoration: none; }
+#HTMLReporter a:hover { text-decoration: underline; }
+#HTMLReporter p, #HTMLReporter h1, #HTMLReporter h2, #HTMLReporter h3, #HTMLReporter h4, #HTMLReporter h5, #HTMLReporter h6 { margin: 0; line-height: 14px; }
+#HTMLReporter .banner, #HTMLReporter .symbolSummary, #HTMLReporter .summary, #HTMLReporter .resultMessage, #HTMLReporter .specDetail .description, #HTMLReporter .alert .bar, #HTMLReporter .stackTrace { padding-left: 9px; padding-right: 9px; }
+#HTMLReporter #jasmine_content { position: fixed; right: 100%; }
+#HTMLReporter .version { color: #aaaaaa; }
+#HTMLReporter .banner { margin-top: 14px; }
+#HTMLReporter .duration { color: #aaaaaa; float: right; }
+#HTMLReporter .symbolSummary { overflow: hidden; *zoom: 1; margin: 14px 0; }
+#HTMLReporter .symbolSummary li { display: block; float: left; height: 7px; width: 14px; margin-bottom: 7px; font-size: 16px; }
+#HTMLReporter .symbolSummary li.passed { font-size: 14px; }
+#HTMLReporter .symbolSummary li.passed:before { color: #5e7d00; content: "\02022"; }
+#HTMLReporter .symbolSummary li.failed { line-height: 9px; }
+#HTMLReporter .symbolSummary li.failed:before { color: #b03911; content: "x"; font-weight: bold; margin-left: -1px; }
+#HTMLReporter .symbolSummary li.skipped { font-size: 14px; }
+#HTMLReporter .symbolSummary li.skipped:before { color: #bababa; content: "\02022"; }
+#HTMLReporter .symbolSummary li.pending { line-height: 11px; }
+#HTMLReporter .symbolSummary li.pending:before { color: #aaaaaa; content: "-"; }
+#HTMLReporter .exceptions { color: #fff; float: right; margin-top: 5px; margin-right: 5px; }
+#HTMLReporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; }
+#HTMLReporter .runningAlert { background-color: #666666; }
+#HTMLReporter .skippedAlert { background-color: #aaaaaa; }
+#HTMLReporter .skippedAlert:first-child { background-color: #333333; }
+#HTMLReporter .skippedAlert:hover { text-decoration: none; color: white; text-decoration: underline; }
+#HTMLReporter .passingAlert { background-color: #a6b779; }
+#HTMLReporter .passingAlert:first-child { background-color: #5e7d00; }
+#HTMLReporter .failingAlert { background-color: #cf867e; }
+#HTMLReporter .failingAlert:first-child { background-color: #b03911; }
+#HTMLReporter .results { margin-top: 14px; }
+#HTMLReporter #details { display: none; }
+#HTMLReporter .resultsMenu, #HTMLReporter .resultsMenu a { background-color: #fff; color: #333333; }
+#HTMLReporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; }
+#HTMLReporter.showDetails .summaryMenuItem:hover { text-decoration: underline; }
+#HTMLReporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; }
+#HTMLReporter.showDetails .summary { display: none; }
+#HTMLReporter.showDetails #details { display: block; }
+#HTMLReporter .summaryMenuItem { font-weight: bold; text-decoration: underline; }
+#HTMLReporter .summary { margin-top: 14px; }
+#HTMLReporter .summary .suite .suite, #HTMLReporter .summary .specSummary { margin-left: 14px; }
+#HTMLReporter .summary .specSummary.passed a { color: #5e7d00; }
+#HTMLReporter .summary .specSummary.failed a { color: #b03911; }
+#HTMLReporter .description + .suite { margin-top: 0; }
+#HTMLReporter .suite { margin-top: 14px; }
+#HTMLReporter .suite a { color: #333333; }
+#HTMLReporter #details .specDetail { margin-bottom: 28px; }
+#HTMLReporter #details .specDetail .description { display: block; color: white; background-color: #b03911; }
+#HTMLReporter .resultMessage { padding-top: 14px; color: #333333; }
+#HTMLReporter .resultMessage span.result { display: block; }
+#HTMLReporter .stackTrace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #ddd; background: white; white-space: pre; }
+
+#TrivialReporter { padding: 8px 13px; position: absolute; top: 0; bottom: 0; left: 0; right: 0; overflow-y: scroll; background-color: white; font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; /*.resultMessage {*/ /*white-space: pre;*/ /*}*/ }
+#TrivialReporter a:visited, #TrivialReporter a { color: #303; }
+#TrivialReporter a:hover, #TrivialReporter a:active { color: blue; }
+#TrivialReporter .run_spec { float: right; padding-right: 5px; font-size: .8em; text-decoration: none; }
+#TrivialReporter .banner { color: #303; background-color: #fef; padding: 5px; }
+#TrivialReporter .logo { float: left; font-size: 1.1em; padding-left: 5px; }
+#TrivialReporter .logo .version { font-size: .6em; padding-left: 1em; }
+#TrivialReporter .runner.running { background-color: yellow; }
+#TrivialReporter .options { text-align: right; font-size: .8em; }
+#TrivialReporter .suite { border: 1px outset gray; margin: 5px 0; padding-left: 1em; }
+#TrivialReporter .suite .suite { margin: 5px; }
+#TrivialReporter .suite.passed { background-color: #dfd; }
+#TrivialReporter .suite.failed { background-color: #fdd; }
+#TrivialReporter .spec { margin: 5px; padding-left: 1em; clear: both; }
+#TrivialReporter .spec.failed, #TrivialReporter .spec.passed, #TrivialReporter .spec.skipped { padding-bottom: 5px; border: 1px solid gray; }
+#TrivialReporter .spec.failed { background-color: #fbb; border-color: red; }
+#TrivialReporter .spec.passed { background-color: #bfb; border-color: green; }
+#TrivialReporter .spec.skipped { background-color: #bbb; }
+#TrivialReporter .messages { border-left: 1px dashed gray; padding-left: 1em; padding-right: 1em; }
+#TrivialReporter .passed { background-color: #cfc; display: none; }
+#TrivialReporter .failed { background-color: #fbb; }
+#TrivialReporter .skipped { color: #777; background-color: #eee; display: none; }
+#TrivialReporter .resultMessage span.result { display: block; line-height: 2em; color: black; }
+#TrivialReporter .resultMessage .mismatch { color: black; }
+#TrivialReporter .stackTrace { white-space: pre; font-size: .8em; margin-left: 10px; max-height: 5em; overflow: auto; border: 1px inset red; padding: 1em; background: #eef; }
+#TrivialReporter .finished-at { padding-left: 1em; font-size: .6em; }
+#TrivialReporter.show-passed .passed, #TrivialReporter.show-skipped .skipped { display: block; }
+#TrivialReporter #jasmine_content { position: fixed; right: 100%; }
+#TrivialReporter .runner { border: 1px solid gray; display: block; margin: 5px 0; padding: 2px 0 2px 10px; }
diff --git a/lib/jasmine-1.3.1/jasmine.js b/lib/jasmine-1.3.1/jasmine.js
new file mode 100644
index 0000000..6b3459b
--- /dev/null
+++ b/lib/jasmine-1.3.1/jasmine.js
@@ -0,0 +1,2600 @@
+var isCommonJS = typeof window == "undefined" && typeof exports == "object";
+
+/**
+ * Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.
+ *
+ * @namespace
+ */
+var jasmine = {};
+if (isCommonJS) exports.jasmine = jasmine;
+/**
+ * @private
+ */
+jasmine.unimplementedMethod_ = function() {
+ throw new Error("unimplemented method");
+};
+
+/**
+ * Use jasmine.undefined
instead of undefined
, since undefined
is just
+ * a plain old variable and may be redefined by somebody else.
+ *
+ * @private
+ */
+jasmine.undefined = jasmine.___undefined___;
+
+/**
+ * Show diagnostic messages in the console if set to true
+ *
+ */
+jasmine.VERBOSE = false;
+
+/**
+ * Default interval in milliseconds for event loop yields (e.g. to allow network activity or to refresh the screen with the HTML-based runner). Small values here may result in slow test running. Zero means no updates until all tests have completed.
+ *
+ */
+jasmine.DEFAULT_UPDATE_INTERVAL = 250;
+
+/**
+ * Maximum levels of nesting that will be included when an object is pretty-printed
+ */
+jasmine.MAX_PRETTY_PRINT_DEPTH = 40;
+
+/**
+ * Default timeout interval in milliseconds for waitsFor() blocks.
+ */
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
+
+/**
+ * By default exceptions thrown in the context of a test are caught by jasmine so that it can run the remaining tests in the suite.
+ * Set to false to let the exception bubble up in the browser.
+ *
+ */
+jasmine.CATCH_EXCEPTIONS = true;
+
+jasmine.getGlobal = function() {
+ function getGlobal() {
+ return this;
+ }
+
+ return getGlobal();
+};
+
+/**
+ * Allows for bound functions to be compared. Internal use only.
+ *
+ * @ignore
+ * @private
+ * @param base {Object} bound 'this' for the function
+ * @param name {Function} function to find
+ */
+jasmine.bindOriginal_ = function(base, name) {
+ var original = base[name];
+ if (original.apply) {
+ return function() {
+ return original.apply(base, arguments);
+ };
+ } else {
+ // IE support
+ return jasmine.getGlobal()[name];
+ }
+};
+
+jasmine.setTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'setTimeout');
+jasmine.clearTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearTimeout');
+jasmine.setInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'setInterval');
+jasmine.clearInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearInterval');
+
+jasmine.MessageResult = function(values) {
+ this.type = 'log';
+ this.values = values;
+ this.trace = new Error(); // todo: test better
+};
+
+jasmine.MessageResult.prototype.toString = function() {
+ var text = "";
+ for (var i = 0; i < this.values.length; i++) {
+ if (i > 0) text += " ";
+ if (jasmine.isString_(this.values[i])) {
+ text += this.values[i];
+ } else {
+ text += jasmine.pp(this.values[i]);
+ }
+ }
+ return text;
+};
+
+jasmine.ExpectationResult = function(params) {
+ this.type = 'expect';
+ this.matcherName = params.matcherName;
+ this.passed_ = params.passed;
+ this.expected = params.expected;
+ this.actual = params.actual;
+ this.message = this.passed_ ? 'Passed.' : params.message;
+
+ var trace = (params.trace || new Error(this.message));
+ this.trace = this.passed_ ? '' : trace;
+};
+
+jasmine.ExpectationResult.prototype.toString = function () {
+ return this.message;
+};
+
+jasmine.ExpectationResult.prototype.passed = function () {
+ return this.passed_;
+};
+
+/**
+ * Getter for the Jasmine environment. Ensures one gets created
+ */
+jasmine.getEnv = function() {
+ var env = jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env();
+ return env;
+};
+
+/**
+ * @ignore
+ * @private
+ * @param value
+ * @returns {Boolean}
+ */
+jasmine.isArray_ = function(value) {
+ return jasmine.isA_("Array", value);
+};
+
+/**
+ * @ignore
+ * @private
+ * @param value
+ * @returns {Boolean}
+ */
+jasmine.isString_ = function(value) {
+ return jasmine.isA_("String", value);
+};
+
+/**
+ * @ignore
+ * @private
+ * @param value
+ * @returns {Boolean}
+ */
+jasmine.isNumber_ = function(value) {
+ return jasmine.isA_("Number", value);
+};
+
+/**
+ * @ignore
+ * @private
+ * @param {String} typeName
+ * @param value
+ * @returns {Boolean}
+ */
+jasmine.isA_ = function(typeName, value) {
+ return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
+};
+
+/**
+ * Pretty printer for expecations. Takes any object and turns it into a human-readable string.
+ *
+ * @param value {Object} an object to be outputted
+ * @returns {String}
+ */
+jasmine.pp = function(value) {
+ var stringPrettyPrinter = new jasmine.StringPrettyPrinter();
+ stringPrettyPrinter.format(value);
+ return stringPrettyPrinter.string;
+};
+
+/**
+ * Returns true if the object is a DOM Node.
+ *
+ * @param {Object} obj object to check
+ * @returns {Boolean}
+ */
+jasmine.isDomNode = function(obj) {
+ return obj.nodeType > 0;
+};
+
+/**
+ * Returns a matchable 'generic' object of the class type. For use in expecations of type when values don't matter.
+ *
+ * @example
+ * // don't care about which function is passed in, as long as it's a function
+ * expect(mySpy).toHaveBeenCalledWith(jasmine.any(Function));
+ *
+ * @param {Class} clazz
+ * @returns matchable object of the type clazz
+ */
+jasmine.any = function(clazz) {
+ return new jasmine.Matchers.Any(clazz);
+};
+
+/**
+ * Returns a matchable subset of a JSON object. For use in expectations when you don't care about all of the
+ * attributes on the object.
+ *
+ * @example
+ * // don't care about any other attributes than foo.
+ * expect(mySpy).toHaveBeenCalledWith(jasmine.objectContaining({foo: "bar"});
+ *
+ * @param sample {Object} sample
+ * @returns matchable object for the sample
+ */
+jasmine.objectContaining = function (sample) {
+ return new jasmine.Matchers.ObjectContaining(sample);
+};
+
+/**
+ * Jasmine Spies are test doubles that can act as stubs, spies, fakes or when used in an expecation, mocks.
+ *
+ * Spies should be created in test setup, before expectations. They can then be checked, using the standard Jasmine
+ * expectation syntax. Spies can be checked if they were called or not and what the calling params were.
+ *
+ * A Spy has the following fields: wasCalled, callCount, mostRecentCall, and argsForCall (see docs).
+ *
+ * Spies are torn down at the end of every spec.
+ *
+ * Note: Do not call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj.
+ *
+ * @example
+ * // a stub
+ * var myStub = jasmine.createSpy('myStub'); // can be used anywhere
+ *
+ * // spy example
+ * var foo = {
+ * not: function(bool) { return !bool; }
+ * }
+ *
+ * // actual foo.not will not be called, execution stops
+ * spyOn(foo, 'not');
+
+ // foo.not spied upon, execution will continue to implementation
+ * spyOn(foo, 'not').andCallThrough();
+ *
+ * // fake example
+ * var foo = {
+ * not: function(bool) { return !bool; }
+ * }
+ *
+ * // foo.not(val) will return val
+ * spyOn(foo, 'not').andCallFake(function(value) {return value;});
+ *
+ * // mock example
+ * foo.not(7 == 7);
+ * expect(foo.not).toHaveBeenCalled();
+ * expect(foo.not).toHaveBeenCalledWith(true);
+ *
+ * @constructor
+ * @see spyOn, jasmine.createSpy, jasmine.createSpyObj
+ * @param {String} name
+ */
+jasmine.Spy = function(name) {
+ /**
+ * The name of the spy, if provided.
+ */
+ this.identity = name || 'unknown';
+ /**
+ * Is this Object a spy?
+ */
+ this.isSpy = true;
+ /**
+ * The actual function this spy stubs.
+ */
+ this.plan = function() {
+ };
+ /**
+ * Tracking of the most recent call to the spy.
+ * @example
+ * var mySpy = jasmine.createSpy('foo');
+ * mySpy(1, 2);
+ * mySpy.mostRecentCall.args = [1, 2];
+ */
+ this.mostRecentCall = {};
+
+ /**
+ * Holds arguments for each call to the spy, indexed by call count
+ * @example
+ * var mySpy = jasmine.createSpy('foo');
+ * mySpy(1, 2);
+ * mySpy(7, 8);
+ * mySpy.mostRecentCall.args = [7, 8];
+ * mySpy.argsForCall[0] = [1, 2];
+ * mySpy.argsForCall[1] = [7, 8];
+ */
+ this.argsForCall = [];
+ this.calls = [];
+};
+
+/**
+ * Tells a spy to call through to the actual implemenatation.
+ *
+ * @example
+ * var foo = {
+ * bar: function() { // do some stuff }
+ * }
+ *
+ * // defining a spy on an existing property: foo.bar
+ * spyOn(foo, 'bar').andCallThrough();
+ */
+jasmine.Spy.prototype.andCallThrough = function() {
+ this.plan = this.originalValue;
+ return this;
+};
+
+/**
+ * For setting the return value of a spy.
+ *
+ * @example
+ * // defining a spy from scratch: foo() returns 'baz'
+ * var foo = jasmine.createSpy('spy on foo').andReturn('baz');
+ *
+ * // defining a spy on an existing property: foo.bar() returns 'baz'
+ * spyOn(foo, 'bar').andReturn('baz');
+ *
+ * @param {Object} value
+ */
+jasmine.Spy.prototype.andReturn = function(value) {
+ this.plan = function() {
+ return value;
+ };
+ return this;
+};
+
+/**
+ * For throwing an exception when a spy is called.
+ *
+ * @example
+ * // defining a spy from scratch: foo() throws an exception w/ message 'ouch'
+ * var foo = jasmine.createSpy('spy on foo').andThrow('baz');
+ *
+ * // defining a spy on an existing property: foo.bar() throws an exception w/ message 'ouch'
+ * spyOn(foo, 'bar').andThrow('baz');
+ *
+ * @param {String} exceptionMsg
+ */
+jasmine.Spy.prototype.andThrow = function(exceptionMsg) {
+ this.plan = function() {
+ throw exceptionMsg;
+ };
+ return this;
+};
+
+/**
+ * Calls an alternate implementation when a spy is called.
+ *
+ * @example
+ * var baz = function() {
+ * // do some stuff, return something
+ * }
+ * // defining a spy from scratch: foo() calls the function baz
+ * var foo = jasmine.createSpy('spy on foo').andCall(baz);
+ *
+ * // defining a spy on an existing property: foo.bar() calls an anonymnous function
+ * spyOn(foo, 'bar').andCall(function() { return 'baz';} );
+ *
+ * @param {Function} fakeFunc
+ */
+jasmine.Spy.prototype.andCallFake = function(fakeFunc) {
+ this.plan = fakeFunc;
+ return this;
+};
+
+/**
+ * Resets all of a spy's the tracking variables so that it can be used again.
+ *
+ * @example
+ * spyOn(foo, 'bar');
+ *
+ * foo.bar();
+ *
+ * expect(foo.bar.callCount).toEqual(1);
+ *
+ * foo.bar.reset();
+ *
+ * expect(foo.bar.callCount).toEqual(0);
+ */
+jasmine.Spy.prototype.reset = function() {
+ this.wasCalled = false;
+ this.callCount = 0;
+ this.argsForCall = [];
+ this.calls = [];
+ this.mostRecentCall = {};
+};
+
+jasmine.createSpy = function(name) {
+
+ var spyObj = function() {
+ spyObj.wasCalled = true;
+ spyObj.callCount++;
+ var args = jasmine.util.argsToArray(arguments);
+ spyObj.mostRecentCall.object = this;
+ spyObj.mostRecentCall.args = args;
+ spyObj.argsForCall.push(args);
+ spyObj.calls.push({object: this, args: args});
+ return spyObj.plan.apply(this, arguments);
+ };
+
+ var spy = new jasmine.Spy(name);
+
+ for (var prop in spy) {
+ spyObj[prop] = spy[prop];
+ }
+
+ spyObj.reset();
+
+ return spyObj;
+};
+
+/**
+ * Determines whether an object is a spy.
+ *
+ * @param {jasmine.Spy|Object} putativeSpy
+ * @returns {Boolean}
+ */
+jasmine.isSpy = function(putativeSpy) {
+ return putativeSpy && putativeSpy.isSpy;
+};
+
+/**
+ * Creates a more complicated spy: an Object that has every property a function that is a spy. Used for stubbing something
+ * large in one call.
+ *
+ * @param {String} baseName name of spy class
+ * @param {Array} methodNames array of names of methods to make spies
+ */
+jasmine.createSpyObj = function(baseName, methodNames) {
+ if (!jasmine.isArray_(methodNames) || methodNames.length === 0) {
+ throw new Error('createSpyObj requires a non-empty array of method names to create spies for');
+ }
+ var obj = {};
+ for (var i = 0; i < methodNames.length; i++) {
+ obj[methodNames[i]] = jasmine.createSpy(baseName + '.' + methodNames[i]);
+ }
+ return obj;
+};
+
+/**
+ * All parameters are pretty-printed and concatenated together, then written to the current spec's output.
+ *
+ * Be careful not to leave calls to jasmine.log
in production code.
+ */
+jasmine.log = function() {
+ var spec = jasmine.getEnv().currentSpec;
+ spec.log.apply(spec, arguments);
+};
+
+/**
+ * Function that installs a spy on an existing object's method name. Used within a Spec to create a spy.
+ *
+ * @example
+ * // spy example
+ * var foo = {
+ * not: function(bool) { return !bool; }
+ * }
+ * spyOn(foo, 'not'); // actual foo.not will not be called, execution stops
+ *
+ * @see jasmine.createSpy
+ * @param obj
+ * @param methodName
+ * @return {jasmine.Spy} a Jasmine spy that can be chained with all spy methods
+ */
+var spyOn = function(obj, methodName) {
+ return jasmine.getEnv().currentSpec.spyOn(obj, methodName);
+};
+if (isCommonJS) exports.spyOn = spyOn;
+
+/**
+ * Creates a Jasmine spec that will be added to the current suite.
+ *
+ * // TODO: pending tests
+ *
+ * @example
+ * it('should be true', function() {
+ * expect(true).toEqual(true);
+ * });
+ *
+ * @param {String} desc description of this specification
+ * @param {Function} func defines the preconditions and expectations of the spec
+ */
+var it = function(desc, func) {
+ return jasmine.getEnv().it(desc, func);
+};
+if (isCommonJS) exports.it = it;
+
+/**
+ * Creates a disabled Jasmine spec.
+ *
+ * A convenience method that allows existing specs to be disabled temporarily during development.
+ *
+ * @param {String} desc description of this specification
+ * @param {Function} func defines the preconditions and expectations of the spec
+ */
+var xit = function(desc, func) {
+ return jasmine.getEnv().xit(desc, func);
+};
+if (isCommonJS) exports.xit = xit;
+
+/**
+ * Starts a chain for a Jasmine expectation.
+ *
+ * It is passed an Object that is the actual value and should chain to one of the many
+ * jasmine.Matchers functions.
+ *
+ * @param {Object} actual Actual value to test against and expected value
+ * @return {jasmine.Matchers}
+ */
+var expect = function(actual) {
+ return jasmine.getEnv().currentSpec.expect(actual);
+};
+if (isCommonJS) exports.expect = expect;
+
+/**
+ * Defines part of a jasmine spec. Used in cominbination with waits or waitsFor in asynchrnous specs.
+ *
+ * @param {Function} func Function that defines part of a jasmine spec.
+ */
+var runs = function(func) {
+ jasmine.getEnv().currentSpec.runs(func);
+};
+if (isCommonJS) exports.runs = runs;
+
+/**
+ * Waits a fixed time period before moving to the next block.
+ *
+ * @deprecated Use waitsFor() instead
+ * @param {Number} timeout milliseconds to wait
+ */
+var waits = function(timeout) {
+ jasmine.getEnv().currentSpec.waits(timeout);
+};
+if (isCommonJS) exports.waits = waits;
+
+/**
+ * Waits for the latchFunction to return true before proceeding to the next block.
+ *
+ * @param {Function} latchFunction
+ * @param {String} optional_timeoutMessage
+ * @param {Number} optional_timeout
+ */
+var waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) {
+ jasmine.getEnv().currentSpec.waitsFor.apply(jasmine.getEnv().currentSpec, arguments);
+};
+if (isCommonJS) exports.waitsFor = waitsFor;
+
+/**
+ * A function that is called before each spec in a suite.
+ *
+ * Used for spec setup, including validating assumptions.
+ *
+ * @param {Function} beforeEachFunction
+ */
+var beforeEach = function(beforeEachFunction) {
+ jasmine.getEnv().beforeEach(beforeEachFunction);
+};
+if (isCommonJS) exports.beforeEach = beforeEach;
+
+/**
+ * A function that is called after each spec in a suite.
+ *
+ * Used for restoring any state that is hijacked during spec execution.
+ *
+ * @param {Function} afterEachFunction
+ */
+var afterEach = function(afterEachFunction) {
+ jasmine.getEnv().afterEach(afterEachFunction);
+};
+if (isCommonJS) exports.afterEach = afterEach;
+
+/**
+ * Defines a suite of specifications.
+ *
+ * Stores the description and all defined specs in the Jasmine environment as one suite of specs. Variables declared
+ * are accessible by calls to beforeEach, it, and afterEach. Describe blocks can be nested, allowing for specialization
+ * of setup in some tests.
+ *
+ * @example
+ * // TODO: a simple suite
+ *
+ * // TODO: a simple suite with a nested describe block
+ *
+ * @param {String} description A string, usually the class under test.
+ * @param {Function} specDefinitions function that defines several specs.
+ */
+var describe = function(description, specDefinitions) {
+ return jasmine.getEnv().describe(description, specDefinitions);
+};
+if (isCommonJS) exports.describe = describe;
+
+/**
+ * Disables a suite of specifications. Used to disable some suites in a file, or files, temporarily during development.
+ *
+ * @param {String} description A string, usually the class under test.
+ * @param {Function} specDefinitions function that defines several specs.
+ */
+var xdescribe = function(description, specDefinitions) {
+ return jasmine.getEnv().xdescribe(description, specDefinitions);
+};
+if (isCommonJS) exports.xdescribe = xdescribe;
+
+
+// Provide the XMLHttpRequest class for IE 5.x-6.x:
+jasmine.XmlHttpRequest = (typeof XMLHttpRequest == "undefined") ? function() {
+ function tryIt(f) {
+ try {
+ return f();
+ } catch(e) {
+ }
+ return null;
+ }
+
+ var xhr = tryIt(function() {
+ return new ActiveXObject("Msxml2.XMLHTTP.6.0");
+ }) ||
+ tryIt(function() {
+ return new ActiveXObject("Msxml2.XMLHTTP.3.0");
+ }) ||
+ tryIt(function() {
+ return new ActiveXObject("Msxml2.XMLHTTP");
+ }) ||
+ tryIt(function() {
+ return new ActiveXObject("Microsoft.XMLHTTP");
+ });
+
+ if (!xhr) throw new Error("This browser does not support XMLHttpRequest.");
+
+ return xhr;
+} : XMLHttpRequest;
+/**
+ * @namespace
+ */
+jasmine.util = {};
+
+/**
+ * Declare that a child class inherit it's prototype from the parent class.
+ *
+ * @private
+ * @param {Function} childClass
+ * @param {Function} parentClass
+ */
+jasmine.util.inherit = function(childClass, parentClass) {
+ /**
+ * @private
+ */
+ var subclass = function() {
+ };
+ subclass.prototype = parentClass.prototype;
+ childClass.prototype = new subclass();
+};
+
+jasmine.util.formatException = function(e) {
+ var lineNumber;
+ if (e.line) {
+ lineNumber = e.line;
+ }
+ else if (e.lineNumber) {
+ lineNumber = e.lineNumber;
+ }
+
+ var file;
+
+ if (e.sourceURL) {
+ file = e.sourceURL;
+ }
+ else if (e.fileName) {
+ file = e.fileName;
+ }
+
+ var message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString();
+
+ if (file && lineNumber) {
+ message += ' in ' + file + ' (line ' + lineNumber + ')';
+ }
+
+ return message;
+};
+
+jasmine.util.htmlEscape = function(str) {
+ if (!str) return str;
+ return str.replace(/&/g, '&')
+ .replace(//g, '>');
+};
+
+jasmine.util.argsToArray = function(args) {
+ var arrayOfArgs = [];
+ for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]);
+ return arrayOfArgs;
+};
+
+jasmine.util.extend = function(destination, source) {
+ for (var property in source) destination[property] = source[property];
+ return destination;
+};
+
+/**
+ * Environment for Jasmine
+ *
+ * @constructor
+ */
+jasmine.Env = function() {
+ this.currentSpec = null;
+ this.currentSuite = null;
+ this.currentRunner_ = new jasmine.Runner(this);
+
+ this.reporter = new jasmine.MultiReporter();
+
+ this.updateInterval = jasmine.DEFAULT_UPDATE_INTERVAL;
+ this.defaultTimeoutInterval = jasmine.DEFAULT_TIMEOUT_INTERVAL;
+ this.lastUpdate = 0;
+ this.specFilter = function() {
+ return true;
+ };
+
+ this.nextSpecId_ = 0;
+ this.nextSuiteId_ = 0;
+ this.equalityTesters_ = [];
+
+ // wrap matchers
+ this.matchersClass = function() {
+ jasmine.Matchers.apply(this, arguments);
+ };
+ jasmine.util.inherit(this.matchersClass, jasmine.Matchers);
+
+ jasmine.Matchers.wrapInto_(jasmine.Matchers.prototype, this.matchersClass);
+};
+
+
+jasmine.Env.prototype.setTimeout = jasmine.setTimeout;
+jasmine.Env.prototype.clearTimeout = jasmine.clearTimeout;
+jasmine.Env.prototype.setInterval = jasmine.setInterval;
+jasmine.Env.prototype.clearInterval = jasmine.clearInterval;
+
+/**
+ * @returns an object containing jasmine version build info, if set.
+ */
+jasmine.Env.prototype.version = function () {
+ if (jasmine.version_) {
+ return jasmine.version_;
+ } else {
+ throw new Error('Version not set');
+ }
+};
+
+/**
+ * @returns string containing jasmine version build info, if set.
+ */
+jasmine.Env.prototype.versionString = function() {
+ if (!jasmine.version_) {
+ return "version unknown";
+ }
+
+ var version = this.version();
+ var versionString = version.major + "." + version.minor + "." + version.build;
+ if (version.release_candidate) {
+ versionString += ".rc" + version.release_candidate;
+ }
+ versionString += " revision " + version.revision;
+ return versionString;
+};
+
+/**
+ * @returns a sequential integer starting at 0
+ */
+jasmine.Env.prototype.nextSpecId = function () {
+ return this.nextSpecId_++;
+};
+
+/**
+ * @returns a sequential integer starting at 0
+ */
+jasmine.Env.prototype.nextSuiteId = function () {
+ return this.nextSuiteId_++;
+};
+
+/**
+ * Register a reporter to receive status updates from Jasmine.
+ * @param {jasmine.Reporter} reporter An object which will receive status updates.
+ */
+jasmine.Env.prototype.addReporter = function(reporter) {
+ this.reporter.addReporter(reporter);
+};
+
+jasmine.Env.prototype.execute = function() {
+ this.currentRunner_.execute();
+};
+
+jasmine.Env.prototype.describe = function(description, specDefinitions) {
+ var suite = new jasmine.Suite(this, description, specDefinitions, this.currentSuite);
+
+ var parentSuite = this.currentSuite;
+ if (parentSuite) {
+ parentSuite.add(suite);
+ } else {
+ this.currentRunner_.add(suite);
+ }
+
+ this.currentSuite = suite;
+
+ var declarationError = null;
+ try {
+ specDefinitions.call(suite);
+ } catch(e) {
+ declarationError = e;
+ }
+
+ if (declarationError) {
+ this.it("encountered a declaration exception", function() {
+ throw declarationError;
+ });
+ }
+
+ this.currentSuite = parentSuite;
+
+ return suite;
+};
+
+jasmine.Env.prototype.beforeEach = function(beforeEachFunction) {
+ if (this.currentSuite) {
+ this.currentSuite.beforeEach(beforeEachFunction);
+ } else {
+ this.currentRunner_.beforeEach(beforeEachFunction);
+ }
+};
+
+jasmine.Env.prototype.currentRunner = function () {
+ return this.currentRunner_;
+};
+
+jasmine.Env.prototype.afterEach = function(afterEachFunction) {
+ if (this.currentSuite) {
+ this.currentSuite.afterEach(afterEachFunction);
+ } else {
+ this.currentRunner_.afterEach(afterEachFunction);
+ }
+
+};
+
+jasmine.Env.prototype.xdescribe = function(desc, specDefinitions) {
+ return {
+ execute: function() {
+ }
+ };
+};
+
+jasmine.Env.prototype.it = function(description, func) {
+ var spec = new jasmine.Spec(this, this.currentSuite, description);
+ this.currentSuite.add(spec);
+ this.currentSpec = spec;
+
+ if (func) {
+ spec.runs(func);
+ }
+
+ return spec;
+};
+
+jasmine.Env.prototype.xit = function(desc, func) {
+ return {
+ id: this.nextSpecId(),
+ runs: function() {
+ }
+ };
+};
+
+jasmine.Env.prototype.compareRegExps_ = function(a, b, mismatchKeys, mismatchValues) {
+ if (a.source != b.source)
+ mismatchValues.push("expected pattern /" + b.source + "/ is not equal to the pattern /" + a.source + "/");
+
+ if (a.ignoreCase != b.ignoreCase)
+ mismatchValues.push("expected modifier i was" + (b.ignoreCase ? " " : " not ") + "set and does not equal the origin modifier");
+
+ if (a.global != b.global)
+ mismatchValues.push("expected modifier g was" + (b.global ? " " : " not ") + "set and does not equal the origin modifier");
+
+ if (a.multiline != b.multiline)
+ mismatchValues.push("expected modifier m was" + (b.multiline ? " " : " not ") + "set and does not equal the origin modifier");
+
+ if (a.sticky != b.sticky)
+ mismatchValues.push("expected modifier y was" + (b.sticky ? " " : " not ") + "set and does not equal the origin modifier");
+
+ return (mismatchValues.length === 0);
+};
+
+jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchValues) {
+ if (a.__Jasmine_been_here_before__ === b && b.__Jasmine_been_here_before__ === a) {
+ return true;
+ }
+
+ a.__Jasmine_been_here_before__ = b;
+ b.__Jasmine_been_here_before__ = a;
+
+ var hasKey = function(obj, keyName) {
+ return obj !== null && obj[keyName] !== jasmine.undefined;
+ };
+
+ for (var property in b) {
+ if (!hasKey(a, property) && hasKey(b, property)) {
+ mismatchKeys.push("expected has key '" + property + "', but missing from actual.");
+ }
+ }
+ for (property in a) {
+ if (!hasKey(b, property) && hasKey(a, property)) {
+ mismatchKeys.push("expected missing key '" + property + "', but present in actual.");
+ }
+ }
+ for (property in b) {
+ if (property == '__Jasmine_been_here_before__') continue;
+ if (!this.equals_(a[property], b[property], mismatchKeys, mismatchValues)) {
+ mismatchValues.push("'" + property + "' was '" + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + "' in expected, but was '" + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + "' in actual.");
+ }
+ }
+
+ if (jasmine.isArray_(a) && jasmine.isArray_(b) && a.length != b.length) {
+ mismatchValues.push("arrays were not the same length");
+ }
+
+ delete a.__Jasmine_been_here_before__;
+ delete b.__Jasmine_been_here_before__;
+ return (mismatchKeys.length === 0 && mismatchValues.length === 0);
+};
+
+jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
+ mismatchKeys = mismatchKeys || [];
+ mismatchValues = mismatchValues || [];
+
+ for (var i = 0; i < this.equalityTesters_.length; i++) {
+ var equalityTester = this.equalityTesters_[i];
+ var result = equalityTester(a, b, this, mismatchKeys, mismatchValues);
+ if (result !== jasmine.undefined) return result;
+ }
+
+ if (a === b) return true;
+
+ if (a === jasmine.undefined || a === null || b === jasmine.undefined || b === null) {
+ return (a == jasmine.undefined && b == jasmine.undefined);
+ }
+
+ if (jasmine.isDomNode(a) && jasmine.isDomNode(b)) {
+ return a === b;
+ }
+
+ if (a instanceof Date && b instanceof Date) {
+ return a.getTime() == b.getTime();
+ }
+
+ if (a.jasmineMatches) {
+ return a.jasmineMatches(b);
+ }
+
+ if (b.jasmineMatches) {
+ return b.jasmineMatches(a);
+ }
+
+ if (a instanceof jasmine.Matchers.ObjectContaining) {
+ return a.matches(b);
+ }
+
+ if (b instanceof jasmine.Matchers.ObjectContaining) {
+ return b.matches(a);
+ }
+
+ if (jasmine.isString_(a) && jasmine.isString_(b)) {
+ return (a == b);
+ }
+
+ if (jasmine.isNumber_(a) && jasmine.isNumber_(b)) {
+ return (a == b);
+ }
+
+ if (a instanceof RegExp && b instanceof RegExp) {
+ return this.compareRegExps_(a, b, mismatchKeys, mismatchValues);
+ }
+
+ if (typeof a === "object" && typeof b === "object") {
+ return this.compareObjects_(a, b, mismatchKeys, mismatchValues);
+ }
+
+ //Straight check
+ return (a === b);
+};
+
+jasmine.Env.prototype.contains_ = function(haystack, needle) {
+ if (jasmine.isArray_(haystack)) {
+ for (var i = 0; i < haystack.length; i++) {
+ if (this.equals_(haystack[i], needle)) return true;
+ }
+ return false;
+ }
+ return haystack.indexOf(needle) >= 0;
+};
+
+jasmine.Env.prototype.addEqualityTester = function(equalityTester) {
+ this.equalityTesters_.push(equalityTester);
+};
+/** No-op base class for Jasmine reporters.
+ *
+ * @constructor
+ */
+jasmine.Reporter = function() {
+};
+
+//noinspection JSUnusedLocalSymbols
+jasmine.Reporter.prototype.reportRunnerStarting = function(runner) {
+};
+
+//noinspection JSUnusedLocalSymbols
+jasmine.Reporter.prototype.reportRunnerResults = function(runner) {
+};
+
+//noinspection JSUnusedLocalSymbols
+jasmine.Reporter.prototype.reportSuiteResults = function(suite) {
+};
+
+//noinspection JSUnusedLocalSymbols
+jasmine.Reporter.prototype.reportSpecStarting = function(spec) {
+};
+
+//noinspection JSUnusedLocalSymbols
+jasmine.Reporter.prototype.reportSpecResults = function(spec) {
+};
+
+//noinspection JSUnusedLocalSymbols
+jasmine.Reporter.prototype.log = function(str) {
+};
+
+/**
+ * Blocks are functions with executable code that make up a spec.
+ *
+ * @constructor
+ * @param {jasmine.Env} env
+ * @param {Function} func
+ * @param {jasmine.Spec} spec
+ */
+jasmine.Block = function(env, func, spec) {
+ this.env = env;
+ this.func = func;
+ this.spec = spec;
+};
+
+jasmine.Block.prototype.execute = function(onComplete) {
+ if (!jasmine.CATCH_EXCEPTIONS) {
+ this.func.apply(this.spec);
+ }
+ else {
+ try {
+ this.func.apply(this.spec);
+ } catch (e) {
+ this.spec.fail(e);
+ }
+ }
+ onComplete();
+};
+/** JavaScript API reporter.
+ *
+ * @constructor
+ */
+jasmine.JsApiReporter = function() {
+ this.started = false;
+ this.finished = false;
+ this.suites_ = [];
+ this.results_ = {};
+};
+
+jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) {
+ this.started = true;
+ var suites = runner.topLevelSuites();
+ for (var i = 0; i < suites.length; i++) {
+ var suite = suites[i];
+ this.suites_.push(this.summarize_(suite));
+ }
+};
+
+jasmine.JsApiReporter.prototype.suites = function() {
+ return this.suites_;
+};
+
+jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
+ var isSuite = suiteOrSpec instanceof jasmine.Suite;
+ var summary = {
+ id: suiteOrSpec.id,
+ name: suiteOrSpec.description,
+ type: isSuite ? 'suite' : 'spec',
+ children: []
+ };
+
+ if (isSuite) {
+ var children = suiteOrSpec.children();
+ for (var i = 0; i < children.length; i++) {
+ summary.children.push(this.summarize_(children[i]));
+ }
+ }
+ return summary;
+};
+
+jasmine.JsApiReporter.prototype.results = function() {
+ return this.results_;
+};
+
+jasmine.JsApiReporter.prototype.resultsForSpec = function(specId) {
+ return this.results_[specId];
+};
+
+//noinspection JSUnusedLocalSymbols
+jasmine.JsApiReporter.prototype.reportRunnerResults = function(runner) {
+ this.finished = true;
+};
+
+//noinspection JSUnusedLocalSymbols
+jasmine.JsApiReporter.prototype.reportSuiteResults = function(suite) {
+};
+
+//noinspection JSUnusedLocalSymbols
+jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) {
+ this.results_[spec.id] = {
+ messages: spec.results().getItems(),
+ result: spec.results().failedCount > 0 ? "failed" : "passed"
+ };
+};
+
+//noinspection JSUnusedLocalSymbols
+jasmine.JsApiReporter.prototype.log = function(str) {
+};
+
+jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){
+ var results = {};
+ for (var i = 0; i < specIds.length; i++) {
+ var specId = specIds[i];
+ results[specId] = this.summarizeResult_(this.results_[specId]);
+ }
+ return results;
+};
+
+jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
+ var summaryMessages = [];
+ var messagesLength = result.messages.length;
+ for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) {
+ var resultMessage = result.messages[messageIndex];
+ summaryMessages.push({
+ text: resultMessage.type == 'log' ? resultMessage.toString() : jasmine.undefined,
+ passed: resultMessage.passed ? resultMessage.passed() : true,
+ type: resultMessage.type,
+ message: resultMessage.message,
+ trace: {
+ stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : jasmine.undefined
+ }
+ });
+ }
+
+ return {
+ result : result.result,
+ messages : summaryMessages
+ };
+};
+
+/**
+ * @constructor
+ * @param {jasmine.Env} env
+ * @param actual
+ * @param {jasmine.Spec} spec
+ */
+jasmine.Matchers = function(env, actual, spec, opt_isNot) {
+ this.env = env;
+ this.actual = actual;
+ this.spec = spec;
+ this.isNot = opt_isNot || false;
+ this.reportWasCalled_ = false;
+};
+
+// todo: @deprecated as of Jasmine 0.11, remove soon [xw]
+jasmine.Matchers.pp = function(str) {
+ throw new Error("jasmine.Matchers.pp() is no longer supported, please use jasmine.pp() instead!");
+};
+
+// todo: @deprecated Deprecated as of Jasmine 0.10. Rewrite your custom matchers to return true or false. [xw]
+jasmine.Matchers.prototype.report = function(result, failing_message, details) {
+ throw new Error("As of jasmine 0.11, custom matchers must be implemented differently -- please see jasmine docs");
+};
+
+jasmine.Matchers.wrapInto_ = function(prototype, matchersClass) {
+ for (var methodName in prototype) {
+ if (methodName == 'report') continue;
+ var orig = prototype[methodName];
+ matchersClass.prototype[methodName] = jasmine.Matchers.matcherFn_(methodName, orig);
+ }
+};
+
+jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) {
+ return function() {
+ var matcherArgs = jasmine.util.argsToArray(arguments);
+ var result = matcherFunction.apply(this, arguments);
+
+ if (this.isNot) {
+ result = !result;
+ }
+
+ if (this.reportWasCalled_) return result;
+
+ var message;
+ if (!result) {
+ if (this.message) {
+ message = this.message.apply(this, arguments);
+ if (jasmine.isArray_(message)) {
+ message = message[this.isNot ? 1 : 0];
+ }
+ } else {
+ var englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); });
+ message = "Expected " + jasmine.pp(this.actual) + (this.isNot ? " not " : " ") + englishyPredicate;
+ if (matcherArgs.length > 0) {
+ for (var i = 0; i < matcherArgs.length; i++) {
+ if (i > 0) message += ",";
+ message += " " + jasmine.pp(matcherArgs[i]);
+ }
+ }
+ message += ".";
+ }
+ }
+ var expectationResult = new jasmine.ExpectationResult({
+ matcherName: matcherName,
+ passed: result,
+ expected: matcherArgs.length > 1 ? matcherArgs : matcherArgs[0],
+ actual: this.actual,
+ message: message
+ });
+ this.spec.addMatcherResult(expectationResult);
+ return jasmine.undefined;
+ };
+};
+
+
+
+
+/**
+ * toBe: compares the actual to the expected using ===
+ * @param expected
+ */
+jasmine.Matchers.prototype.toBe = function(expected) {
+ return this.actual === expected;
+};
+
+/**
+ * toNotBe: compares the actual to the expected using !==
+ * @param expected
+ * @deprecated as of 1.0. Use not.toBe() instead.
+ */
+jasmine.Matchers.prototype.toNotBe = function(expected) {
+ return this.actual !== expected;
+};
+
+/**
+ * toEqual: compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc.
+ *
+ * @param expected
+ */
+jasmine.Matchers.prototype.toEqual = function(expected) {
+ return this.env.equals_(this.actual, expected);
+};
+
+/**
+ * toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual
+ * @param expected
+ * @deprecated as of 1.0. Use not.toEqual() instead.
+ */
+jasmine.Matchers.prototype.toNotEqual = function(expected) {
+ return !this.env.equals_(this.actual, expected);
+};
+
+/**
+ * Matcher that compares the actual to the expected using a regular expression. Constructs a RegExp, so takes
+ * a pattern or a String.
+ *
+ * @param expected
+ */
+jasmine.Matchers.prototype.toMatch = function(expected) {
+ return new RegExp(expected).test(this.actual);
+};
+
+/**
+ * Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch
+ * @param expected
+ * @deprecated as of 1.0. Use not.toMatch() instead.
+ */
+jasmine.Matchers.prototype.toNotMatch = function(expected) {
+ return !(new RegExp(expected).test(this.actual));
+};
+
+/**
+ * Matcher that compares the actual to jasmine.undefined.
+ */
+jasmine.Matchers.prototype.toBeDefined = function() {
+ return (this.actual !== jasmine.undefined);
+};
+
+/**
+ * Matcher that compares the actual to jasmine.undefined.
+ */
+jasmine.Matchers.prototype.toBeUndefined = function() {
+ return (this.actual === jasmine.undefined);
+};
+
+/**
+ * Matcher that compares the actual to null.
+ */
+jasmine.Matchers.prototype.toBeNull = function() {
+ return (this.actual === null);
+};
+
+/**
+ * Matcher that compares the actual to NaN.
+ */
+jasmine.Matchers.prototype.toBeNaN = function() {
+ this.message = function() {
+ return [ "Expected " + jasmine.pp(this.actual) + " to be NaN." ];
+ };
+
+ return (this.actual !== this.actual);
+};
+
+/**
+ * Matcher that boolean not-nots the actual.
+ */
+jasmine.Matchers.prototype.toBeTruthy = function() {
+ return !!this.actual;
+};
+
+
+/**
+ * Matcher that boolean nots the actual.
+ */
+jasmine.Matchers.prototype.toBeFalsy = function() {
+ return !this.actual;
+};
+
+
+/**
+ * Matcher that checks to see if the actual, a Jasmine spy, was called.
+ */
+jasmine.Matchers.prototype.toHaveBeenCalled = function() {
+ if (arguments.length > 0) {
+ throw new Error('toHaveBeenCalled does not take arguments, use toHaveBeenCalledWith');
+ }
+
+ if (!jasmine.isSpy(this.actual)) {
+ throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
+ }
+
+ this.message = function() {
+ return [
+ "Expected spy " + this.actual.identity + " to have been called.",
+ "Expected spy " + this.actual.identity + " not to have been called."
+ ];
+ };
+
+ return this.actual.wasCalled;
+};
+
+/** @deprecated Use expect(xxx).toHaveBeenCalled() instead */
+jasmine.Matchers.prototype.wasCalled = jasmine.Matchers.prototype.toHaveBeenCalled;
+
+/**
+ * Matcher that checks to see if the actual, a Jasmine spy, was not called.
+ *
+ * @deprecated Use expect(xxx).not.toHaveBeenCalled() instead
+ */
+jasmine.Matchers.prototype.wasNotCalled = function() {
+ if (arguments.length > 0) {
+ throw new Error('wasNotCalled does not take arguments');
+ }
+
+ if (!jasmine.isSpy(this.actual)) {
+ throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
+ }
+
+ this.message = function() {
+ return [
+ "Expected spy " + this.actual.identity + " to not have been called.",
+ "Expected spy " + this.actual.identity + " to have been called."
+ ];
+ };
+
+ return !this.actual.wasCalled;
+};
+
+/**
+ * Matcher that checks to see if the actual, a Jasmine spy, was called with a set of parameters.
+ *
+ * @example
+ *
+ */
+jasmine.Matchers.prototype.toHaveBeenCalledWith = function() {
+ var expectedArgs = jasmine.util.argsToArray(arguments);
+ if (!jasmine.isSpy(this.actual)) {
+ throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
+ }
+ this.message = function() {
+ var invertedMessage = "Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but it was.";
+ var positiveMessage = "";
+ if (this.actual.callCount === 0) {
+ positiveMessage = "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but it was never called.";
+ } else {
+ positiveMessage = "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but actual calls were " + jasmine.pp(this.actual.argsForCall).replace(/^\[ | \]$/g, '')
+ }
+ return [positiveMessage, invertedMessage];
+ };
+
+ return this.env.contains_(this.actual.argsForCall, expectedArgs);
+};
+
+/** @deprecated Use expect(xxx).toHaveBeenCalledWith() instead */
+jasmine.Matchers.prototype.wasCalledWith = jasmine.Matchers.prototype.toHaveBeenCalledWith;
+
+/** @deprecated Use expect(xxx).not.toHaveBeenCalledWith() instead */
+jasmine.Matchers.prototype.wasNotCalledWith = function() {
+ var expectedArgs = jasmine.util.argsToArray(arguments);
+ if (!jasmine.isSpy(this.actual)) {
+ throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
+ }
+
+ this.message = function() {
+ return [
+ "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but it was",
+ "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but it was"
+ ];
+ };
+
+ return !this.env.contains_(this.actual.argsForCall, expectedArgs);
+};
+
+/**
+ * Matcher that checks that the expected item is an element in the actual Array.
+ *
+ * @param {Object} expected
+ */
+jasmine.Matchers.prototype.toContain = function(expected) {
+ return this.env.contains_(this.actual, expected);
+};
+
+/**
+ * Matcher that checks that the expected item is NOT an element in the actual Array.
+ *
+ * @param {Object} expected
+ * @deprecated as of 1.0. Use not.toContain() instead.
+ */
+jasmine.Matchers.prototype.toNotContain = function(expected) {
+ return !this.env.contains_(this.actual, expected);
+};
+
+jasmine.Matchers.prototype.toBeLessThan = function(expected) {
+ return this.actual < expected;
+};
+
+jasmine.Matchers.prototype.toBeGreaterThan = function(expected) {
+ return this.actual > expected;
+};
+
+/**
+ * Matcher that checks that the expected item is equal to the actual item
+ * up to a given level of decimal precision (default 2).
+ *
+ * @param {Number} expected
+ * @param {Number} precision, as number of decimal places
+ */
+jasmine.Matchers.prototype.toBeCloseTo = function(expected, precision) {
+ if (!(precision === 0)) {
+ precision = precision || 2;
+ }
+ return Math.abs(expected - this.actual) < (Math.pow(10, -precision) / 2);
+};
+
+/**
+ * Matcher that checks that the expected exception was thrown by the actual.
+ *
+ * @param {String} [expected]
+ */
+jasmine.Matchers.prototype.toThrow = function(expected) {
+ var result = false;
+ var exception;
+ if (typeof this.actual != 'function') {
+ throw new Error('Actual is not a function');
+ }
+ try {
+ this.actual();
+ } catch (e) {
+ exception = e;
+ }
+ if (exception) {
+ result = (expected === jasmine.undefined || this.env.equals_(exception.message || exception, expected.message || expected));
+ }
+
+ var not = this.isNot ? "not " : "";
+
+ this.message = function() {
+ if (exception && (expected === jasmine.undefined || !this.env.equals_(exception.message || exception, expected.message || expected))) {
+ return ["Expected function " + not + "to throw", expected ? expected.message || expected : "an exception", ", but it threw", exception.message || exception].join(' ');
+ } else {
+ return "Expected function to throw an exception.";
+ }
+ };
+
+ return result;
+};
+
+jasmine.Matchers.Any = function(expectedClass) {
+ this.expectedClass = expectedClass;
+};
+
+jasmine.Matchers.Any.prototype.jasmineMatches = function(other) {
+ if (this.expectedClass == String) {
+ return typeof other == 'string' || other instanceof String;
+ }
+
+ if (this.expectedClass == Number) {
+ return typeof other == 'number' || other instanceof Number;
+ }
+
+ if (this.expectedClass == Function) {
+ return typeof other == 'function' || other instanceof Function;
+ }
+
+ if (this.expectedClass == Object) {
+ return typeof other == 'object';
+ }
+
+ return other instanceof this.expectedClass;
+};
+
+jasmine.Matchers.Any.prototype.jasmineToString = function() {
+ return '';
+};
+
+jasmine.Matchers.ObjectContaining = function (sample) {
+ this.sample = sample;
+};
+
+jasmine.Matchers.ObjectContaining.prototype.jasmineMatches = function(other, mismatchKeys, mismatchValues) {
+ mismatchKeys = mismatchKeys || [];
+ mismatchValues = mismatchValues || [];
+
+ var env = jasmine.getEnv();
+
+ var hasKey = function(obj, keyName) {
+ return obj != null && obj[keyName] !== jasmine.undefined;
+ };
+
+ for (var property in this.sample) {
+ if (!hasKey(other, property) && hasKey(this.sample, property)) {
+ mismatchKeys.push("expected has key '" + property + "', but missing from actual.");
+ }
+ else if (!env.equals_(this.sample[property], other[property], mismatchKeys, mismatchValues)) {
+ mismatchValues.push("'" + property + "' was '" + (other[property] ? jasmine.util.htmlEscape(other[property].toString()) : other[property]) + "' in expected, but was '" + (this.sample[property] ? jasmine.util.htmlEscape(this.sample[property].toString()) : this.sample[property]) + "' in actual.");
+ }
+ }
+
+ return (mismatchKeys.length === 0 && mismatchValues.length === 0);
+};
+
+jasmine.Matchers.ObjectContaining.prototype.jasmineToString = function () {
+ return "";
+};
+// Mock setTimeout, clearTimeout
+// Contributed by Pivotal Computer Systems, www.pivotalsf.com
+
+jasmine.FakeTimer = function() {
+ this.reset();
+
+ var self = this;
+ self.setTimeout = function(funcToCall, millis) {
+ self.timeoutsMade++;
+ self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false);
+ return self.timeoutsMade;
+ };
+
+ self.setInterval = function(funcToCall, millis) {
+ self.timeoutsMade++;
+ self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true);
+ return self.timeoutsMade;
+ };
+
+ self.clearTimeout = function(timeoutKey) {
+ self.scheduledFunctions[timeoutKey] = jasmine.undefined;
+ };
+
+ self.clearInterval = function(timeoutKey) {
+ self.scheduledFunctions[timeoutKey] = jasmine.undefined;
+ };
+
+};
+
+jasmine.FakeTimer.prototype.reset = function() {
+ this.timeoutsMade = 0;
+ this.scheduledFunctions = {};
+ this.nowMillis = 0;
+};
+
+jasmine.FakeTimer.prototype.tick = function(millis) {
+ var oldMillis = this.nowMillis;
+ var newMillis = oldMillis + millis;
+ this.runFunctionsWithinRange(oldMillis, newMillis);
+ this.nowMillis = newMillis;
+};
+
+jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) {
+ var scheduledFunc;
+ var funcsToRun = [];
+ for (var timeoutKey in this.scheduledFunctions) {
+ scheduledFunc = this.scheduledFunctions[timeoutKey];
+ if (scheduledFunc != jasmine.undefined &&
+ scheduledFunc.runAtMillis >= oldMillis &&
+ scheduledFunc.runAtMillis <= nowMillis) {
+ funcsToRun.push(scheduledFunc);
+ this.scheduledFunctions[timeoutKey] = jasmine.undefined;
+ }
+ }
+
+ if (funcsToRun.length > 0) {
+ funcsToRun.sort(function(a, b) {
+ return a.runAtMillis - b.runAtMillis;
+ });
+ for (var i = 0; i < funcsToRun.length; ++i) {
+ try {
+ var funcToRun = funcsToRun[i];
+ this.nowMillis = funcToRun.runAtMillis;
+ funcToRun.funcToCall();
+ if (funcToRun.recurring) {
+ this.scheduleFunction(funcToRun.timeoutKey,
+ funcToRun.funcToCall,
+ funcToRun.millis,
+ true);
+ }
+ } catch(e) {
+ }
+ }
+ this.runFunctionsWithinRange(oldMillis, nowMillis);
+ }
+};
+
+jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) {
+ this.scheduledFunctions[timeoutKey] = {
+ runAtMillis: this.nowMillis + millis,
+ funcToCall: funcToCall,
+ recurring: recurring,
+ timeoutKey: timeoutKey,
+ millis: millis
+ };
+};
+
+/**
+ * @namespace
+ */
+jasmine.Clock = {
+ defaultFakeTimer: new jasmine.FakeTimer(),
+
+ reset: function() {
+ jasmine.Clock.assertInstalled();
+ jasmine.Clock.defaultFakeTimer.reset();
+ },
+
+ tick: function(millis) {
+ jasmine.Clock.assertInstalled();
+ jasmine.Clock.defaultFakeTimer.tick(millis);
+ },
+
+ runFunctionsWithinRange: function(oldMillis, nowMillis) {
+ jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis);
+ },
+
+ scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
+ jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring);
+ },
+
+ useMock: function() {
+ if (!jasmine.Clock.isInstalled()) {
+ var spec = jasmine.getEnv().currentSpec;
+ spec.after(jasmine.Clock.uninstallMock);
+
+ jasmine.Clock.installMock();
+ }
+ },
+
+ installMock: function() {
+ jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer;
+ },
+
+ uninstallMock: function() {
+ jasmine.Clock.assertInstalled();
+ jasmine.Clock.installed = jasmine.Clock.real;
+ },
+
+ real: {
+ setTimeout: jasmine.getGlobal().setTimeout,
+ clearTimeout: jasmine.getGlobal().clearTimeout,
+ setInterval: jasmine.getGlobal().setInterval,
+ clearInterval: jasmine.getGlobal().clearInterval
+ },
+
+ assertInstalled: function() {
+ if (!jasmine.Clock.isInstalled()) {
+ throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
+ }
+ },
+
+ isInstalled: function() {
+ return jasmine.Clock.installed == jasmine.Clock.defaultFakeTimer;
+ },
+
+ installed: null
+};
+jasmine.Clock.installed = jasmine.Clock.real;
+
+//else for IE support
+jasmine.getGlobal().setTimeout = function(funcToCall, millis) {
+ if (jasmine.Clock.installed.setTimeout.apply) {
+ return jasmine.Clock.installed.setTimeout.apply(this, arguments);
+ } else {
+ return jasmine.Clock.installed.setTimeout(funcToCall, millis);
+ }
+};
+
+jasmine.getGlobal().setInterval = function(funcToCall, millis) {
+ if (jasmine.Clock.installed.setInterval.apply) {
+ return jasmine.Clock.installed.setInterval.apply(this, arguments);
+ } else {
+ return jasmine.Clock.installed.setInterval(funcToCall, millis);
+ }
+};
+
+jasmine.getGlobal().clearTimeout = function(timeoutKey) {
+ if (jasmine.Clock.installed.clearTimeout.apply) {
+ return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
+ } else {
+ return jasmine.Clock.installed.clearTimeout(timeoutKey);
+ }
+};
+
+jasmine.getGlobal().clearInterval = function(timeoutKey) {
+ if (jasmine.Clock.installed.clearTimeout.apply) {
+ return jasmine.Clock.installed.clearInterval.apply(this, arguments);
+ } else {
+ return jasmine.Clock.installed.clearInterval(timeoutKey);
+ }
+};
+
+/**
+ * @constructor
+ */
+jasmine.MultiReporter = function() {
+ this.subReporters_ = [];
+};
+jasmine.util.inherit(jasmine.MultiReporter, jasmine.Reporter);
+
+jasmine.MultiReporter.prototype.addReporter = function(reporter) {
+ this.subReporters_.push(reporter);
+};
+
+(function() {
+ var functionNames = [
+ "reportRunnerStarting",
+ "reportRunnerResults",
+ "reportSuiteResults",
+ "reportSpecStarting",
+ "reportSpecResults",
+ "log"
+ ];
+ for (var i = 0; i < functionNames.length; i++) {
+ var functionName = functionNames[i];
+ jasmine.MultiReporter.prototype[functionName] = (function(functionName) {
+ return function() {
+ for (var j = 0; j < this.subReporters_.length; j++) {
+ var subReporter = this.subReporters_[j];
+ if (subReporter[functionName]) {
+ subReporter[functionName].apply(subReporter, arguments);
+ }
+ }
+ };
+ })(functionName);
+ }
+})();
+/**
+ * Holds results for a set of Jasmine spec. Allows for the results array to hold another jasmine.NestedResults
+ *
+ * @constructor
+ */
+jasmine.NestedResults = function() {
+ /**
+ * The total count of results
+ */
+ this.totalCount = 0;
+ /**
+ * Number of passed results
+ */
+ this.passedCount = 0;
+ /**
+ * Number of failed results
+ */
+ this.failedCount = 0;
+ /**
+ * Was this suite/spec skipped?
+ */
+ this.skipped = false;
+ /**
+ * @ignore
+ */
+ this.items_ = [];
+};
+
+/**
+ * Roll up the result counts.
+ *
+ * @param result
+ */
+jasmine.NestedResults.prototype.rollupCounts = function(result) {
+ this.totalCount += result.totalCount;
+ this.passedCount += result.passedCount;
+ this.failedCount += result.failedCount;
+};
+
+/**
+ * Adds a log message.
+ * @param values Array of message parts which will be concatenated later.
+ */
+jasmine.NestedResults.prototype.log = function(values) {
+ this.items_.push(new jasmine.MessageResult(values));
+};
+
+/**
+ * Getter for the results: message & results.
+ */
+jasmine.NestedResults.prototype.getItems = function() {
+ return this.items_;
+};
+
+/**
+ * Adds a result, tracking counts (total, passed, & failed)
+ * @param {jasmine.ExpectationResult|jasmine.NestedResults} result
+ */
+jasmine.NestedResults.prototype.addResult = function(result) {
+ if (result.type != 'log') {
+ if (result.items_) {
+ this.rollupCounts(result);
+ } else {
+ this.totalCount++;
+ if (result.passed()) {
+ this.passedCount++;
+ } else {
+ this.failedCount++;
+ }
+ }
+ }
+ this.items_.push(result);
+};
+
+/**
+ * @returns {Boolean} True if everything below passed
+ */
+jasmine.NestedResults.prototype.passed = function() {
+ return this.passedCount === this.totalCount;
+};
+/**
+ * Base class for pretty printing for expectation results.
+ */
+jasmine.PrettyPrinter = function() {
+ this.ppNestLevel_ = 0;
+};
+
+/**
+ * Formats a value in a nice, human-readable string.
+ *
+ * @param value
+ */
+jasmine.PrettyPrinter.prototype.format = function(value) {
+ this.ppNestLevel_++;
+ try {
+ if (value === jasmine.undefined) {
+ this.emitScalar('undefined');
+ } else if (value === null) {
+ this.emitScalar('null');
+ } else if (value === jasmine.getGlobal()) {
+ this.emitScalar('');
+ } else if (value.jasmineToString) {
+ this.emitScalar(value.jasmineToString());
+ } else if (typeof value === 'string') {
+ this.emitString(value);
+ } else if (jasmine.isSpy(value)) {
+ this.emitScalar("spy on " + value.identity);
+ } else if (value instanceof RegExp) {
+ this.emitScalar(value.toString());
+ } else if (typeof value === 'function') {
+ this.emitScalar('Function');
+ } else if (typeof value.nodeType === 'number') {
+ this.emitScalar('HTMLNode');
+ } else if (value instanceof Date) {
+ this.emitScalar('Date(' + value + ')');
+ } else if (value.__Jasmine_been_here_before__) {
+ this.emitScalar('');
+ } else if (jasmine.isArray_(value) || typeof value == 'object') {
+ value.__Jasmine_been_here_before__ = true;
+ if (jasmine.isArray_(value)) {
+ this.emitArray(value);
+ } else {
+ this.emitObject(value);
+ }
+ delete value.__Jasmine_been_here_before__;
+ } else {
+ this.emitScalar(value.toString());
+ }
+ } finally {
+ this.ppNestLevel_--;
+ }
+};
+
+jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
+ for (var property in obj) {
+ if (!obj.hasOwnProperty(property)) continue;
+ if (property == '__Jasmine_been_here_before__') continue;
+ fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) !== jasmine.undefined &&
+ obj.__lookupGetter__(property) !== null) : false);
+ }
+};
+
+jasmine.PrettyPrinter.prototype.emitArray = jasmine.unimplementedMethod_;
+jasmine.PrettyPrinter.prototype.emitObject = jasmine.unimplementedMethod_;
+jasmine.PrettyPrinter.prototype.emitScalar = jasmine.unimplementedMethod_;
+jasmine.PrettyPrinter.prototype.emitString = jasmine.unimplementedMethod_;
+
+jasmine.StringPrettyPrinter = function() {
+ jasmine.PrettyPrinter.call(this);
+
+ this.string = '';
+};
+jasmine.util.inherit(jasmine.StringPrettyPrinter, jasmine.PrettyPrinter);
+
+jasmine.StringPrettyPrinter.prototype.emitScalar = function(value) {
+ this.append(value);
+};
+
+jasmine.StringPrettyPrinter.prototype.emitString = function(value) {
+ this.append("'" + value + "'");
+};
+
+jasmine.StringPrettyPrinter.prototype.emitArray = function(array) {
+ if (this.ppNestLevel_ > jasmine.MAX_PRETTY_PRINT_DEPTH) {
+ this.append("Array");
+ return;
+ }
+
+ this.append('[ ');
+ for (var i = 0; i < array.length; i++) {
+ if (i > 0) {
+ this.append(', ');
+ }
+ this.format(array[i]);
+ }
+ this.append(' ]');
+};
+
+jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) {
+ if (this.ppNestLevel_ > jasmine.MAX_PRETTY_PRINT_DEPTH) {
+ this.append("Object");
+ return;
+ }
+
+ var self = this;
+ this.append('{ ');
+ var first = true;
+
+ this.iterateObject(obj, function(property, isGetter) {
+ if (first) {
+ first = false;
+ } else {
+ self.append(', ');
+ }
+
+ self.append(property);
+ self.append(' : ');
+ if (isGetter) {
+ self.append('');
+ } else {
+ self.format(obj[property]);
+ }
+ });
+
+ this.append(' }');
+};
+
+jasmine.StringPrettyPrinter.prototype.append = function(value) {
+ this.string += value;
+};
+jasmine.Queue = function(env) {
+ this.env = env;
+
+ // parallel to blocks. each true value in this array means the block will
+ // get executed even if we abort
+ this.ensured = [];
+ this.blocks = [];
+ this.running = false;
+ this.index = 0;
+ this.offset = 0;
+ this.abort = false;
+};
+
+jasmine.Queue.prototype.addBefore = function(block, ensure) {
+ if (ensure === jasmine.undefined) {
+ ensure = false;
+ }
+
+ this.blocks.unshift(block);
+ this.ensured.unshift(ensure);
+};
+
+jasmine.Queue.prototype.add = function(block, ensure) {
+ if (ensure === jasmine.undefined) {
+ ensure = false;
+ }
+
+ this.blocks.push(block);
+ this.ensured.push(ensure);
+};
+
+jasmine.Queue.prototype.insertNext = function(block, ensure) {
+ if (ensure === jasmine.undefined) {
+ ensure = false;
+ }
+
+ this.ensured.splice((this.index + this.offset + 1), 0, ensure);
+ this.blocks.splice((this.index + this.offset + 1), 0, block);
+ this.offset++;
+};
+
+jasmine.Queue.prototype.start = function(onComplete) {
+ this.running = true;
+ this.onComplete = onComplete;
+ this.next_();
+};
+
+jasmine.Queue.prototype.isRunning = function() {
+ return this.running;
+};
+
+jasmine.Queue.LOOP_DONT_RECURSE = true;
+
+jasmine.Queue.prototype.next_ = function() {
+ var self = this;
+ var goAgain = true;
+
+ while (goAgain) {
+ goAgain = false;
+
+ if (self.index < self.blocks.length && !(this.abort && !this.ensured[self.index])) {
+ var calledSynchronously = true;
+ var completedSynchronously = false;
+
+ var onComplete = function () {
+ if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) {
+ completedSynchronously = true;
+ return;
+ }
+
+ if (self.blocks[self.index].abort) {
+ self.abort = true;
+ }
+
+ self.offset = 0;
+ self.index++;
+
+ var now = new Date().getTime();
+ if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) {
+ self.env.lastUpdate = now;
+ self.env.setTimeout(function() {
+ self.next_();
+ }, 0);
+ } else {
+ if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) {
+ goAgain = true;
+ } else {
+ self.next_();
+ }
+ }
+ };
+ self.blocks[self.index].execute(onComplete);
+
+ calledSynchronously = false;
+ if (completedSynchronously) {
+ onComplete();
+ }
+
+ } else {
+ self.running = false;
+ if (self.onComplete) {
+ self.onComplete();
+ }
+ }
+ }
+};
+
+jasmine.Queue.prototype.results = function() {
+ var results = new jasmine.NestedResults();
+ for (var i = 0; i < this.blocks.length; i++) {
+ if (this.blocks[i].results) {
+ results.addResult(this.blocks[i].results());
+ }
+ }
+ return results;
+};
+
+
+/**
+ * Runner
+ *
+ * @constructor
+ * @param {jasmine.Env} env
+ */
+jasmine.Runner = function(env) {
+ var self = this;
+ self.env = env;
+ self.queue = new jasmine.Queue(env);
+ self.before_ = [];
+ self.after_ = [];
+ self.suites_ = [];
+};
+
+jasmine.Runner.prototype.execute = function() {
+ var self = this;
+ if (self.env.reporter.reportRunnerStarting) {
+ self.env.reporter.reportRunnerStarting(this);
+ }
+ self.queue.start(function () {
+ self.finishCallback();
+ });
+};
+
+jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) {
+ beforeEachFunction.typeName = 'beforeEach';
+ this.before_.splice(0,0,beforeEachFunction);
+};
+
+jasmine.Runner.prototype.afterEach = function(afterEachFunction) {
+ afterEachFunction.typeName = 'afterEach';
+ this.after_.splice(0,0,afterEachFunction);
+};
+
+
+jasmine.Runner.prototype.finishCallback = function() {
+ this.env.reporter.reportRunnerResults(this);
+};
+
+jasmine.Runner.prototype.addSuite = function(suite) {
+ this.suites_.push(suite);
+};
+
+jasmine.Runner.prototype.add = function(block) {
+ if (block instanceof jasmine.Suite) {
+ this.addSuite(block);
+ }
+ this.queue.add(block);
+};
+
+jasmine.Runner.prototype.specs = function () {
+ var suites = this.suites();
+ var specs = [];
+ for (var i = 0; i < suites.length; i++) {
+ specs = specs.concat(suites[i].specs());
+ }
+ return specs;
+};
+
+jasmine.Runner.prototype.suites = function() {
+ return this.suites_;
+};
+
+jasmine.Runner.prototype.topLevelSuites = function() {
+ var topLevelSuites = [];
+ for (var i = 0; i < this.suites_.length; i++) {
+ if (!this.suites_[i].parentSuite) {
+ topLevelSuites.push(this.suites_[i]);
+ }
+ }
+ return topLevelSuites;
+};
+
+jasmine.Runner.prototype.results = function() {
+ return this.queue.results();
+};
+/**
+ * Internal representation of a Jasmine specification, or test.
+ *
+ * @constructor
+ * @param {jasmine.Env} env
+ * @param {jasmine.Suite} suite
+ * @param {String} description
+ */
+jasmine.Spec = function(env, suite, description) {
+ if (!env) {
+ throw new Error('jasmine.Env() required');
+ }
+ if (!suite) {
+ throw new Error('jasmine.Suite() required');
+ }
+ var spec = this;
+ spec.id = env.nextSpecId ? env.nextSpecId() : null;
+ spec.env = env;
+ spec.suite = suite;
+ spec.description = description;
+ spec.queue = new jasmine.Queue(env);
+
+ spec.afterCallbacks = [];
+ spec.spies_ = [];
+
+ spec.results_ = new jasmine.NestedResults();
+ spec.results_.description = description;
+ spec.matchersClass = null;
+};
+
+jasmine.Spec.prototype.getFullName = function() {
+ return this.suite.getFullName() + ' ' + this.description + '.';
+};
+
+
+jasmine.Spec.prototype.results = function() {
+ return this.results_;
+};
+
+/**
+ * All parameters are pretty-printed and concatenated together, then written to the spec's output.
+ *
+ * Be careful not to leave calls to jasmine.log
in production code.
+ */
+jasmine.Spec.prototype.log = function() {
+ return this.results_.log(arguments);
+};
+
+jasmine.Spec.prototype.runs = function (func) {
+ var block = new jasmine.Block(this.env, func, this);
+ this.addToQueue(block);
+ return this;
+};
+
+jasmine.Spec.prototype.addToQueue = function (block) {
+ if (this.queue.isRunning()) {
+ this.queue.insertNext(block);
+ } else {
+ this.queue.add(block);
+ }
+};
+
+/**
+ * @param {jasmine.ExpectationResult} result
+ */
+jasmine.Spec.prototype.addMatcherResult = function(result) {
+ this.results_.addResult(result);
+};
+
+jasmine.Spec.prototype.expect = function(actual) {
+ var positive = new (this.getMatchersClass_())(this.env, actual, this);
+ positive.not = new (this.getMatchersClass_())(this.env, actual, this, true);
+ return positive;
+};
+
+/**
+ * Waits a fixed time period before moving to the next block.
+ *
+ * @deprecated Use waitsFor() instead
+ * @param {Number} timeout milliseconds to wait
+ */
+jasmine.Spec.prototype.waits = function(timeout) {
+ var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this);
+ this.addToQueue(waitsFunc);
+ return this;
+};
+
+/**
+ * Waits for the latchFunction to return true before proceeding to the next block.
+ *
+ * @param {Function} latchFunction
+ * @param {String} optional_timeoutMessage
+ * @param {Number} optional_timeout
+ */
+jasmine.Spec.prototype.waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) {
+ var latchFunction_ = null;
+ var optional_timeoutMessage_ = null;
+ var optional_timeout_ = null;
+
+ for (var i = 0; i < arguments.length; i++) {
+ var arg = arguments[i];
+ switch (typeof arg) {
+ case 'function':
+ latchFunction_ = arg;
+ break;
+ case 'string':
+ optional_timeoutMessage_ = arg;
+ break;
+ case 'number':
+ optional_timeout_ = arg;
+ break;
+ }
+ }
+
+ var waitsForFunc = new jasmine.WaitsForBlock(this.env, optional_timeout_, latchFunction_, optional_timeoutMessage_, this);
+ this.addToQueue(waitsForFunc);
+ return this;
+};
+
+jasmine.Spec.prototype.fail = function (e) {
+ var expectationResult = new jasmine.ExpectationResult({
+ passed: false,
+ message: e ? jasmine.util.formatException(e) : 'Exception',
+ trace: { stack: e.stack }
+ });
+ this.results_.addResult(expectationResult);
+};
+
+jasmine.Spec.prototype.getMatchersClass_ = function() {
+ return this.matchersClass || this.env.matchersClass;
+};
+
+jasmine.Spec.prototype.addMatchers = function(matchersPrototype) {
+ var parent = this.getMatchersClass_();
+ var newMatchersClass = function() {
+ parent.apply(this, arguments);
+ };
+ jasmine.util.inherit(newMatchersClass, parent);
+ jasmine.Matchers.wrapInto_(matchersPrototype, newMatchersClass);
+ this.matchersClass = newMatchersClass;
+};
+
+jasmine.Spec.prototype.finishCallback = function() {
+ this.env.reporter.reportSpecResults(this);
+};
+
+jasmine.Spec.prototype.finish = function(onComplete) {
+ this.removeAllSpies();
+ this.finishCallback();
+ if (onComplete) {
+ onComplete();
+ }
+};
+
+jasmine.Spec.prototype.after = function(doAfter) {
+ if (this.queue.isRunning()) {
+ this.queue.add(new jasmine.Block(this.env, doAfter, this), true);
+ } else {
+ this.afterCallbacks.unshift(doAfter);
+ }
+};
+
+jasmine.Spec.prototype.execute = function(onComplete) {
+ var spec = this;
+ if (!spec.env.specFilter(spec)) {
+ spec.results_.skipped = true;
+ spec.finish(onComplete);
+ return;
+ }
+
+ this.env.reporter.reportSpecStarting(this);
+
+ spec.env.currentSpec = spec;
+
+ spec.addBeforesAndAftersToQueue();
+
+ spec.queue.start(function () {
+ spec.finish(onComplete);
+ });
+};
+
+jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() {
+ var runner = this.env.currentRunner();
+ var i;
+
+ for (var suite = this.suite; suite; suite = suite.parentSuite) {
+ for (i = 0; i < suite.before_.length; i++) {
+ this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this));
+ }
+ }
+ for (i = 0; i < runner.before_.length; i++) {
+ this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this));
+ }
+ for (i = 0; i < this.afterCallbacks.length; i++) {
+ this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this), true);
+ }
+ for (suite = this.suite; suite; suite = suite.parentSuite) {
+ for (i = 0; i < suite.after_.length; i++) {
+ this.queue.add(new jasmine.Block(this.env, suite.after_[i], this), true);
+ }
+ }
+ for (i = 0; i < runner.after_.length; i++) {
+ this.queue.add(new jasmine.Block(this.env, runner.after_[i], this), true);
+ }
+};
+
+jasmine.Spec.prototype.explodes = function() {
+ throw 'explodes function should not have been called';
+};
+
+jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) {
+ if (obj == jasmine.undefined) {
+ throw "spyOn could not find an object to spy upon for " + methodName + "()";
+ }
+
+ if (!ignoreMethodDoesntExist && obj[methodName] === jasmine.undefined) {
+ throw methodName + '() method does not exist';
+ }
+
+ if (!ignoreMethodDoesntExist && obj[methodName] && obj[methodName].isSpy) {
+ throw new Error(methodName + ' has already been spied upon');
+ }
+
+ var spyObj = jasmine.createSpy(methodName);
+
+ this.spies_.push(spyObj);
+ spyObj.baseObj = obj;
+ spyObj.methodName = methodName;
+ spyObj.originalValue = obj[methodName];
+
+ obj[methodName] = spyObj;
+
+ return spyObj;
+};
+
+jasmine.Spec.prototype.removeAllSpies = function() {
+ for (var i = 0; i < this.spies_.length; i++) {
+ var spy = this.spies_[i];
+ spy.baseObj[spy.methodName] = spy.originalValue;
+ }
+ this.spies_ = [];
+};
+
+/**
+ * Internal representation of a Jasmine suite.
+ *
+ * @constructor
+ * @param {jasmine.Env} env
+ * @param {String} description
+ * @param {Function} specDefinitions
+ * @param {jasmine.Suite} parentSuite
+ */
+jasmine.Suite = function(env, description, specDefinitions, parentSuite) {
+ var self = this;
+ self.id = env.nextSuiteId ? env.nextSuiteId() : null;
+ self.description = description;
+ self.queue = new jasmine.Queue(env);
+ self.parentSuite = parentSuite;
+ self.env = env;
+ self.before_ = [];
+ self.after_ = [];
+ self.children_ = [];
+ self.suites_ = [];
+ self.specs_ = [];
+};
+
+jasmine.Suite.prototype.getFullName = function() {
+ var fullName = this.description;
+ for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) {
+ fullName = parentSuite.description + ' ' + fullName;
+ }
+ return fullName;
+};
+
+jasmine.Suite.prototype.finish = function(onComplete) {
+ this.env.reporter.reportSuiteResults(this);
+ this.finished = true;
+ if (typeof(onComplete) == 'function') {
+ onComplete();
+ }
+};
+
+jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) {
+ beforeEachFunction.typeName = 'beforeEach';
+ this.before_.unshift(beforeEachFunction);
+};
+
+jasmine.Suite.prototype.afterEach = function(afterEachFunction) {
+ afterEachFunction.typeName = 'afterEach';
+ this.after_.unshift(afterEachFunction);
+};
+
+jasmine.Suite.prototype.results = function() {
+ return this.queue.results();
+};
+
+jasmine.Suite.prototype.add = function(suiteOrSpec) {
+ this.children_.push(suiteOrSpec);
+ if (suiteOrSpec instanceof jasmine.Suite) {
+ this.suites_.push(suiteOrSpec);
+ this.env.currentRunner().addSuite(suiteOrSpec);
+ } else {
+ this.specs_.push(suiteOrSpec);
+ }
+ this.queue.add(suiteOrSpec);
+};
+
+jasmine.Suite.prototype.specs = function() {
+ return this.specs_;
+};
+
+jasmine.Suite.prototype.suites = function() {
+ return this.suites_;
+};
+
+jasmine.Suite.prototype.children = function() {
+ return this.children_;
+};
+
+jasmine.Suite.prototype.execute = function(onComplete) {
+ var self = this;
+ this.queue.start(function () {
+ self.finish(onComplete);
+ });
+};
+jasmine.WaitsBlock = function(env, timeout, spec) {
+ this.timeout = timeout;
+ jasmine.Block.call(this, env, null, spec);
+};
+
+jasmine.util.inherit(jasmine.WaitsBlock, jasmine.Block);
+
+jasmine.WaitsBlock.prototype.execute = function (onComplete) {
+ if (jasmine.VERBOSE) {
+ this.env.reporter.log('>> Jasmine waiting for ' + this.timeout + ' ms...');
+ }
+ this.env.setTimeout(function () {
+ onComplete();
+ }, this.timeout);
+};
+/**
+ * A block which waits for some condition to become true, with timeout.
+ *
+ * @constructor
+ * @extends jasmine.Block
+ * @param {jasmine.Env} env The Jasmine environment.
+ * @param {Number} timeout The maximum time in milliseconds to wait for the condition to become true.
+ * @param {Function} latchFunction A function which returns true when the desired condition has been met.
+ * @param {String} message The message to display if the desired condition hasn't been met within the given time period.
+ * @param {jasmine.Spec} spec The Jasmine spec.
+ */
+jasmine.WaitsForBlock = function(env, timeout, latchFunction, message, spec) {
+ this.timeout = timeout || env.defaultTimeoutInterval;
+ this.latchFunction = latchFunction;
+ this.message = message;
+ this.totalTimeSpentWaitingForLatch = 0;
+ jasmine.Block.call(this, env, null, spec);
+};
+jasmine.util.inherit(jasmine.WaitsForBlock, jasmine.Block);
+
+jasmine.WaitsForBlock.TIMEOUT_INCREMENT = 10;
+
+jasmine.WaitsForBlock.prototype.execute = function(onComplete) {
+ if (jasmine.VERBOSE) {
+ this.env.reporter.log('>> Jasmine waiting for ' + (this.message || 'something to happen'));
+ }
+ var latchFunctionResult;
+ try {
+ latchFunctionResult = this.latchFunction.apply(this.spec);
+ } catch (e) {
+ this.spec.fail(e);
+ onComplete();
+ return;
+ }
+
+ if (latchFunctionResult) {
+ onComplete();
+ } else if (this.totalTimeSpentWaitingForLatch >= this.timeout) {
+ var message = 'timed out after ' + this.timeout + ' msec waiting for ' + (this.message || 'something to happen');
+ this.spec.fail({
+ name: 'timeout',
+ message: message
+ });
+
+ this.abort = true;
+ onComplete();
+ } else {
+ this.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT;
+ var self = this;
+ this.env.setTimeout(function() {
+ self.execute(onComplete);
+ }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT);
+ }
+};
+
+jasmine.version_= {
+ "major": 1,
+ "minor": 3,
+ "build": 1,
+ "revision": 1354556913
+};
diff --git a/lib/jasmine-jquery.js b/lib/jasmine-jquery.js
new file mode 100644
index 0000000..3a5a028
--- /dev/null
+++ b/lib/jasmine-jquery.js
@@ -0,0 +1,659 @@
+/*!
+ Jasmine-jQuery: a set of jQuery helpers for Jasmine tests.
+
+ Version 1.5.2
+
+ https://github.com/velesin/jasmine-jquery
+
+ Copyright (c) 2010-2013 Wojciech Zawistowski, Travis Jeffery
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+var readFixtures = function() {
+ return jasmine.getFixtures().proxyCallTo_('read', arguments)
+}
+
+var preloadFixtures = function() {
+ jasmine.getFixtures().proxyCallTo_('preload', arguments)
+}
+
+var loadFixtures = function() {
+ jasmine.getFixtures().proxyCallTo_('load', arguments)
+}
+
+var appendLoadFixtures = function() {
+ jasmine.getFixtures().proxyCallTo_('appendLoad', arguments)
+}
+
+var setFixtures = function(html) {
+ jasmine.getFixtures().proxyCallTo_('set', arguments)
+}
+
+var appendSetFixtures = function() {
+ jasmine.getFixtures().proxyCallTo_('appendSet', arguments)
+}
+
+var sandbox = function(attributes) {
+ return jasmine.getFixtures().sandbox(attributes)
+}
+
+var spyOnEvent = function(selector, eventName) {
+ return jasmine.JQuery.events.spyOn(selector, eventName)
+}
+
+var preloadStyleFixtures = function() {
+ jasmine.getStyleFixtures().proxyCallTo_('preload', arguments)
+}
+
+var loadStyleFixtures = function() {
+ jasmine.getStyleFixtures().proxyCallTo_('load', arguments)
+}
+
+var appendLoadStyleFixtures = function() {
+ jasmine.getStyleFixtures().proxyCallTo_('appendLoad', arguments)
+}
+
+var setStyleFixtures = function(html) {
+ jasmine.getStyleFixtures().proxyCallTo_('set', arguments)
+}
+
+var appendSetStyleFixtures = function(html) {
+ jasmine.getStyleFixtures().proxyCallTo_('appendSet', arguments)
+}
+
+var loadJSONFixtures = function() {
+ return jasmine.getJSONFixtures().proxyCallTo_('load', arguments)
+}
+
+var getJSONFixture = function(url) {
+ return jasmine.getJSONFixtures().proxyCallTo_('read', arguments)[url]
+}
+
+jasmine.spiedEventsKey = function (selector, eventName) {
+ return [$(selector).selector, eventName].toString()
+}
+
+jasmine.getFixtures = function() {
+ return jasmine.currentFixtures_ = jasmine.currentFixtures_ || new jasmine.Fixtures()
+}
+
+jasmine.getStyleFixtures = function() {
+ return jasmine.currentStyleFixtures_ = jasmine.currentStyleFixtures_ || new jasmine.StyleFixtures()
+}
+
+jasmine.Fixtures = function() {
+ this.containerId = 'jasmine-fixtures'
+ this.fixturesCache_ = {}
+ this.fixturesPath = 'spec/javascripts/fixtures'
+}
+
+jasmine.Fixtures.prototype.set = function(html) {
+ this.cleanUp()
+ this.createContainer_(html)
+}
+
+jasmine.Fixtures.prototype.appendSet= function(html) {
+ this.addToContainer_(html)
+}
+
+jasmine.Fixtures.prototype.preload = function() {
+ this.read.apply(this, arguments)
+}
+
+jasmine.Fixtures.prototype.load = function() {
+ this.cleanUp()
+ this.createContainer_(this.read.apply(this, arguments))
+}
+
+jasmine.Fixtures.prototype.appendLoad = function() {
+ this.addToContainer_(this.read.apply(this, arguments))
+}
+
+jasmine.Fixtures.prototype.read = function() {
+ var htmlChunks = []
+
+ var fixtureUrls = arguments
+ for(var urlCount = fixtureUrls.length, urlIndex = 0; urlIndex < urlCount; urlIndex++) {
+ htmlChunks.push(this.getFixtureHtml_(fixtureUrls[urlIndex]))
+ }
+
+ return htmlChunks.join('')
+}
+
+jasmine.Fixtures.prototype.clearCache = function() {
+ this.fixturesCache_ = {}
+}
+
+jasmine.Fixtures.prototype.cleanUp = function() {
+ $('#' + this.containerId).remove()
+}
+
+jasmine.Fixtures.prototype.sandbox = function(attributes) {
+ var attributesToSet = attributes || {}
+ return $('
').attr(attributesToSet)
+}
+
+jasmine.Fixtures.prototype.createContainer_ = function(html) {
+ var container
+ if(html instanceof $) {
+ container = $('
')
+ container.html(html)
+ } else {
+ container = '' + html + '
'
+ }
+ $(document.body).append(container)
+}
+
+jasmine.Fixtures.prototype.addToContainer_ = function(html){
+ var container = $(document.body).find('#'+this.containerId).append(html)
+ if(!container.length){
+ this.createContainer_(html)
+ }
+}
+
+jasmine.Fixtures.prototype.getFixtureHtml_ = function(url) {
+ if (typeof this.fixturesCache_[url] === 'undefined') {
+ this.loadFixtureIntoCache_(url)
+ }
+ return this.fixturesCache_[url]
+}
+
+jasmine.Fixtures.prototype.loadFixtureIntoCache_ = function(relativeUrl) {
+ var url = this.makeFixtureUrl_(relativeUrl)
+ var request = $.ajax({
+ type: "GET",
+ url: url + "?" + new Date().getTime(),
+ async: false
+ })
+ this.fixturesCache_[relativeUrl] = request.responseText
+}
+
+jasmine.Fixtures.prototype.makeFixtureUrl_ = function(relativeUrl){
+ return this.fixturesPath.match('/$') ? this.fixturesPath + relativeUrl : this.fixturesPath + '/' + relativeUrl
+}
+
+jasmine.Fixtures.prototype.proxyCallTo_ = function(methodName, passedArguments) {
+ return this[methodName].apply(this, passedArguments)
+}
+
+
+jasmine.StyleFixtures = function() {
+ this.fixturesCache_ = {}
+ this.fixturesNodes_ = []
+ this.fixturesPath = 'spec/javascripts/fixtures'
+}
+
+jasmine.StyleFixtures.prototype.set = function(css) {
+ this.cleanUp()
+ this.createStyle_(css)
+}
+
+jasmine.StyleFixtures.prototype.appendSet = function(css) {
+ this.createStyle_(css)
+}
+
+jasmine.StyleFixtures.prototype.preload = function() {
+ this.read_.apply(this, arguments)
+}
+
+jasmine.StyleFixtures.prototype.load = function() {
+ this.cleanUp()
+ this.createStyle_(this.read_.apply(this, arguments))
+}
+
+jasmine.StyleFixtures.prototype.appendLoad = function() {
+ this.createStyle_(this.read_.apply(this, arguments))
+}
+
+jasmine.StyleFixtures.prototype.cleanUp = function() {
+ while(this.fixturesNodes_.length) {
+ this.fixturesNodes_.pop().remove()
+ }
+}
+
+jasmine.StyleFixtures.prototype.createStyle_ = function(html) {
+ var styleText = $('
').html(html).text(),
+ style = $('')
+
+ this.fixturesNodes_.push(style)
+
+ $('head').append(style)
+}
+
+jasmine.StyleFixtures.prototype.clearCache = jasmine.Fixtures.prototype.clearCache
+
+jasmine.StyleFixtures.prototype.read_ = jasmine.Fixtures.prototype.read
+
+jasmine.StyleFixtures.prototype.getFixtureHtml_ = jasmine.Fixtures.prototype.getFixtureHtml_
+
+jasmine.StyleFixtures.prototype.loadFixtureIntoCache_ = jasmine.Fixtures.prototype.loadFixtureIntoCache_
+
+jasmine.StyleFixtures.prototype.makeFixtureUrl_ = jasmine.Fixtures.prototype.makeFixtureUrl_
+
+jasmine.StyleFixtures.prototype.proxyCallTo_ = jasmine.Fixtures.prototype.proxyCallTo_
+
+jasmine.getJSONFixtures = function() {
+ return jasmine.currentJSONFixtures_ = jasmine.currentJSONFixtures_ || new jasmine.JSONFixtures()
+}
+
+jasmine.JSONFixtures = function() {
+ this.fixturesCache_ = {}
+ this.fixturesPath = 'spec/javascripts/fixtures/json'
+}
+
+jasmine.JSONFixtures.prototype.load = function() {
+ this.read.apply(this, arguments)
+ return this.fixturesCache_
+}
+
+jasmine.JSONFixtures.prototype.read = function() {
+ var fixtureUrls = arguments
+ for(var urlCount = fixtureUrls.length, urlIndex = 0; urlIndex < urlCount; urlIndex++) {
+ this.getFixtureData_(fixtureUrls[urlIndex])
+ }
+ return this.fixturesCache_
+}
+
+jasmine.JSONFixtures.prototype.clearCache = function() {
+ this.fixturesCache_ = {}
+}
+
+jasmine.JSONFixtures.prototype.getFixtureData_ = function(url) {
+ this.loadFixtureIntoCache_(url)
+ return this.fixturesCache_[url]
+}
+
+jasmine.JSONFixtures.prototype.loadFixtureIntoCache_ = function(relativeUrl) {
+ var self = this
+ var url = this.fixturesPath.match('/$') ? this.fixturesPath + relativeUrl : this.fixturesPath + '/' + relativeUrl
+ $.ajax({
+ async: false, // must be synchronous to guarantee that no tests are run before fixture is loaded
+ cache: false,
+ dataType: 'json',
+ url: url,
+ success: function(data) {
+ self.fixturesCache_[relativeUrl] = data
+ },
+ error: function(jqXHR, status, errorThrown) {
+ throw Error('JSONFixture could not be loaded: ' + url + ' (status: ' + status + ', message: ' + errorThrown.message + ')')
+ }
+ })
+}
+
+jasmine.JSONFixtures.prototype.proxyCallTo_ = function(methodName, passedArguments) {
+ return this[methodName].apply(this, passedArguments)
+}
+
+jasmine.JQuery = function() {}
+
+jasmine.JQuery.browserTagCaseIndependentHtml = function(html) {
+ return $('
').append(html).html()
+}
+
+jasmine.JQuery.elementToString = function(element) {
+ var domEl = $(element).get(0)
+ if (domEl == undefined || domEl.cloneNode)
+ return $('
').append($(element).clone()).html()
+ else
+ return element.toString()
+}
+
+jasmine.JQuery.matchersClass = {}
+
+!function(namespace) {
+ var data = {
+ spiedEvents: {},
+ handlers: []
+ }
+
+ namespace.events = {
+ spyOn: function(selector, eventName) {
+ var handler = function(e) {
+ data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)] = jasmine.util.argsToArray(arguments)
+ }
+ $(selector).on(eventName, handler)
+ data.handlers.push(handler)
+ return {
+ selector: selector,
+ eventName: eventName,
+ handler: handler,
+ reset: function(){
+ delete data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)]
+ }
+ }
+ },
+
+ args: function(selector, eventName) {
+ var actualArgs = data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)];
+
+ if (!actualArgs) {
+ throw "There is no spy for " + eventName + " on " + selector.toString() + ". Make sure to create a spy using spyOnEvent.";
+ }
+
+ return actualArgs;
+ },
+
+ wasTriggered: function(selector, eventName) {
+ return !!(data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)])
+ },
+
+ wasTriggeredWith: function(selector, eventName, expectedArgs, env) {
+ var actualArgs = jasmine.JQuery.events.args(selector, eventName).slice(1);
+ if (Object.prototype.toString.call(expectedArgs) !== '[object Array]') {
+ actualArgs = actualArgs[0];
+ }
+ return env.equals_(expectedArgs, actualArgs);
+ },
+
+ wasPrevented: function(selector, eventName) {
+ var args = data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)],
+ e = args ? args[0] : undefined;
+ return e && e.isDefaultPrevented()
+ },
+
+ wasStopped: function(selector, eventName) {
+ var args = data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)],
+ e = args ? args[0] : undefined;
+ return e && e.isPropagationStopped()
+ },
+
+ cleanUp: function() {
+ data.spiedEvents = {}
+ data.handlers = []
+ }
+ }
+}(jasmine.JQuery)
+
+!function(){
+ var jQueryMatchers = {
+ toHaveClass: function(className) {
+ return this.actual.hasClass(className)
+ },
+
+ toHaveCss: function(css){
+ for (var prop in css){
+ if (this.actual.css(prop) !== css[prop]) return false
+ }
+ return true
+ },
+
+ toBeVisible: function() {
+ return this.actual.is(':visible')
+ },
+
+ toBeHidden: function() {
+ return this.actual.is(':hidden')
+ },
+
+ toBeSelected: function() {
+ return this.actual.is(':selected')
+ },
+
+ toBeChecked: function() {
+ return this.actual.is(':checked')
+ },
+
+ toBeEmpty: function() {
+ return this.actual.is(':empty')
+ },
+
+ toExist: function() {
+ return $(document).find(this.actual).length
+ },
+
+ toHaveLength: function(length) {
+ return this.actual.length === length
+ },
+
+ toHaveAttr: function(attributeName, expectedAttributeValue) {
+ return hasProperty(this.actual.attr(attributeName), expectedAttributeValue)
+ },
+
+ toHaveProp: function(propertyName, expectedPropertyValue) {
+ return hasProperty(this.actual.prop(propertyName), expectedPropertyValue)
+ },
+
+ toHaveId: function(id) {
+ return this.actual.attr('id') == id
+ },
+
+ toHaveHtml: function(html) {
+ return this.actual.html() == jasmine.JQuery.browserTagCaseIndependentHtml(html)
+ },
+
+ toContainHtml: function(html){
+ var actualHtml = this.actual.html()
+ var expectedHtml = jasmine.JQuery.browserTagCaseIndependentHtml(html)
+ return (actualHtml.indexOf(expectedHtml) >= 0)
+ },
+
+ toHaveText: function(text) {
+ var trimmedText = $.trim(this.actual.text())
+ if (text && $.isFunction(text.test)) {
+ return text.test(trimmedText)
+ } else {
+ return trimmedText == text
+ }
+ },
+
+ toContainText: function(text) {
+ var trimmedText = $.trim(this.actual.text())
+ if (text && $.isFunction(text.test)) {
+ return text.test(trimmedText)
+ } else {
+ return trimmedText.indexOf(text) != -1;
+ }
+ },
+
+ toHaveValue: function(value) {
+ return this.actual.val() === value
+ },
+
+ toHaveData: function(key, expectedValue) {
+ return hasProperty(this.actual.data(key), expectedValue)
+ },
+
+ toBe: function(selector) {
+ return this.actual.is(selector)
+ },
+
+ toContain: function(selector) {
+ return this.actual.find(selector).length
+ },
+
+ toBeDisabled: function(selector){
+ return this.actual.is(':disabled')
+ },
+
+ toBeFocused: function(selector) {
+ return this.actual[0] === this.actual[0].ownerDocument.activeElement
+ },
+
+ toHandle: function(event) {
+
+ var events = $._data(this.actual.get(0), "events")
+
+ if(!events || !event || typeof event !== "string") {
+ return false
+ }
+
+ var namespaces = event.split(".")
+ var eventType = namespaces.shift()
+ var sortedNamespaces = namespaces.slice(0).sort()
+ var namespaceRegExp = new RegExp("(^|\\.)" + sortedNamespaces.join("\\.(?:.*\\.)?") + "(\\.|$)")
+
+ if(events[eventType] && namespaces.length) {
+ for(var i = 0; i < events[eventType].length; i++) {
+ var namespace = events[eventType][i].namespace
+ if(namespaceRegExp.test(namespace)) {
+ return true
+ }
+ }
+ } else {
+ return events[eventType] && events[eventType].length > 0
+ }
+ },
+
+ // tests the existence of a specific event binding + handler
+ toHandleWith: function(eventName, eventHandler) {
+ var stack = $._data(this.actual.get(0), "events")[eventName]
+ for (var i = 0; i < stack.length; i++) {
+ if (stack[i].handler == eventHandler) return true
+ }
+ return false
+ }
+ }
+
+ var hasProperty = function(actualValue, expectedValue) {
+ if (expectedValue === undefined) return actualValue !== undefined
+ return actualValue == expectedValue
+ }
+
+ var bindMatcher = function(methodName) {
+ var builtInMatcher = jasmine.Matchers.prototype[methodName]
+
+ jasmine.JQuery.matchersClass[methodName] = function() {
+ if (this.actual
+ && (this.actual instanceof $
+ || jasmine.isDomNode(this.actual))) {
+ this.actual = $(this.actual)
+ var result = jQueryMatchers[methodName].apply(this, arguments)
+ var element
+ if (this.actual.get && (element = this.actual.get()[0]) && !$.isWindow(element) && element.tagName !== "HTML")
+ this.actual = jasmine.JQuery.elementToString(this.actual)
+ return result
+ }
+
+ if (builtInMatcher) {
+ return builtInMatcher.apply(this, arguments)
+ }
+
+ return false
+ }
+ }
+
+ for(var methodName in jQueryMatchers) {
+ bindMatcher(methodName)
+ }
+}()
+
+beforeEach(function() {
+ this.addMatchers(jasmine.JQuery.matchersClass)
+ this.addMatchers({
+ toHaveBeenTriggeredOn: function(selector) {
+ this.message = function() {
+ return [
+ "Expected event " + this.actual + " to have been triggered on " + selector,
+ "Expected event " + this.actual + " not to have been triggered on " + selector
+ ]
+ }
+ return jasmine.JQuery.events.wasTriggered(selector, this.actual)
+ }
+ })
+ this.addMatchers({
+ toHaveBeenTriggered: function(){
+ var eventName = this.actual.eventName,
+ selector = this.actual.selector
+ this.message = function() {
+ return [
+ "Expected event " + eventName + " to have been triggered on " + selector,
+ "Expected event " + eventName + " not to have been triggered on " + selector
+ ]
+ }
+ return jasmine.JQuery.events.wasTriggered(selector, eventName)
+ }
+ })
+ this.addMatchers({
+ toHaveBeenTriggeredOnAndWith: function() {
+ var selector = arguments[0],
+ expectedArgs = arguments[1],
+ wasTriggered = jasmine.JQuery.events.wasTriggered(selector, this.actual);
+ this.message = function() {
+ if (wasTriggered) {
+ var actualArgs = jasmine.JQuery.events.args(selector, this.actual, expectedArgs)[1];
+ return [
+ "Expected event " + this.actual + " to have been triggered with " + jasmine.pp(expectedArgs) + " but it was triggered with " + jasmine.pp(actualArgs),
+ "Expected event " + this.actual + " not to have been triggered with " + jasmine.pp(expectedArgs) + " but it was triggered with " + jasmine.pp(actualArgs)
+ ]
+ } else {
+ return [
+ "Expected event " + this.actual + " to have been triggered on " + selector,
+ "Expected event " + this.actual + " not to have been triggered on " + selector
+ ]
+ }
+ }
+ return wasTriggered && jasmine.JQuery.events.wasTriggeredWith(selector, this.actual, expectedArgs, this.env);
+ }
+ })
+ this.addMatchers({
+ toHaveBeenPreventedOn: function(selector) {
+ this.message = function() {
+ return [
+ "Expected event " + this.actual + " to have been prevented on " + selector,
+ "Expected event " + this.actual + " not to have been prevented on " + selector
+ ]
+ }
+ return jasmine.JQuery.events.wasPrevented(selector, this.actual)
+ }
+ })
+ this.addMatchers({
+ toHaveBeenPrevented: function() {
+ var eventName = this.actual.eventName,
+ selector = this.actual.selector
+ this.message = function() {
+ return [
+ "Expected event " + eventName + " to have been prevented on " + selector,
+ "Expected event " + eventName + " not to have been prevented on " + selector
+ ]
+ }
+ return jasmine.JQuery.events.wasPrevented(selector, eventName)
+ }
+ })
+ this.addMatchers({
+ toHaveBeenStoppedOn: function(selector) {
+ this.message = function() {
+ return [
+ "Expected event " + this.actual + " to have been stopped on " + selector,
+ "Expected event " + this.actual + " not to have been stopped on " + selector
+ ]
+ }
+ return jasmine.JQuery.events.wasStopped(selector, this.actual)
+ }
+ })
+ this.addMatchers({
+ toHaveBeenStopped: function() {
+ var eventName = this.actual.eventName,
+ selector = this.actual.selector
+ this.message = function() {
+ return [
+ "Expected event " + eventName + " to have been stopped on " + selector,
+ "Expected event " + eventName + " not to have been stopped on " + selector
+ ]
+ }
+ return jasmine.JQuery.events.wasStopped(selector, eventName)
+ }
+ })
+})
+
+afterEach(function() {
+ jasmine.getFixtures().cleanUp()
+ jasmine.getStyleFixtures().cleanUp()
+ jasmine.JQuery.events.cleanUp()
+})
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..81e0e6d
--- /dev/null
+++ b/package.json
@@ -0,0 +1,40 @@
+{
+ "name": "jquery-ui-timepicker-addon",
+ "version": "1.6.3",
+ "engines": {
+ "node": ">= 0.8.0"
+ },
+ "keywords": [
+ "timepicker", "jquery", "datetime", "jquery-ui"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/trentrichardson/jQuery-Timepicker-Addon.git"
+ },
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "https://raw.github.com/trentrichardson/jQuery-Timepicker-Addon/master/LICENSE-MIT"
+ }
+ ],
+ "homepage": "http://trentrichardson.com/examples/timepicker",
+ "main": "./dist/jquery-ui-timepicker-addon.js",
+ "browser": "./dist/jquery-ui-timepicker-addon.js",
+ "scripts": {
+ "start": "grunt",
+ "test": "grunt test"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "grunt-contrib-jshint": "~0.1.1",
+ "grunt-contrib-jasmine": "~0.5.1",
+ "grunt-contrib-concat": "~0.4.0",
+ "grunt-contrib-uglify": "~0.9.1",
+ "grunt-contrib-watch": "~0.2.0",
+ "grunt-contrib-clean": "~0.4.0",
+ "grunt-contrib-copy": "~0.4.0",
+ "grunt-contrib-cssmin": "~0.6.0",
+ "grunt-replace": "~0.4.4",
+ "grunt": "~0.4.1"
+ }
+}
diff --git a/src/.jshintrc b/src/.jshintrc
new file mode 100644
index 0000000..a624e4c
--- /dev/null
+++ b/src/.jshintrc
@@ -0,0 +1,17 @@
+{
+ "evil": true,
+ "curly": true,
+ "eqeqeq": true,
+ "immed": true,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "sub": true,
+ "undef": true,
+ "unused": false,
+ "loopfunc": true,
+ "boss": true,
+ "eqnull": true,
+ "browser": true,
+ "predef": ["jQuery","define"]
+}
diff --git a/src/docs/examples.html b/src/docs/examples.html
new file mode 100644
index 0000000..fa112d1
--- /dev/null
+++ b/src/docs/examples.html
@@ -0,0 +1,556 @@
+
+
+
+
Examples
+
+
+
+
Basic Initializations
+
+
+
+
Add a simple datetimepicker to jQuery UI's datepicker
+
+
+
+
+$('#basic_example_1').datetimepicker();
+
+
+
+
+
+
+
Add only a timepicker:
+
+
+
+
+$('#basic_example_2').timepicker();
+
+
+
+
+
+
Format the time:
+
+
+
+
+$('#basic_example_3').datetimepicker({
+ timeFormat: "hh:mm tt"
+});
+
+
+
+
+
+
+
Timepicker comes with a collection of localization files and one combined file with all available localizations. $.timepicker.regional["your localization code here"] is a simple object with preset options:
+
+
+
+
+$('#basic_example_4').timepicker(
+ $.timepicker.regional['es']
+);
+
+
+
+
Using Timezones
+
+
+
+
Simplest timezone usage:
+
+
+
+
+$('#timezone_example_1').datetimepicker({
+ timeFormat: 'hh:mm tt z'
+});
+
+
+
+
+
+
Define your own timezone options:
+
+
+
+
+$('#timezone_example_2').datetimepicker({
+ timeFormat: 'HH:mm z',
+ timezoneList: [
+ { value: -300, label: 'Eastern'},
+ { value: -360, label: 'Central' },
+ { value: -420, label: 'Mountain' },
+ { value: -480, label: 'Pacific' }
+ ]
+});
+
+
+
+
Slider Modifications
+
+
+
+
Add a grid to each slider:
+
+
+
+
+$('#slider_example_1').timepicker({
+ hourGrid: 4,
+ minuteGrid: 10,
+ timeFormat: 'hh:mm tt'
+});
+
+
+
+
+
+
Set the interval step of sliders:
+
+
+
+
+$('#slider_example_2').datetimepicker({
+ timeFormat: 'HH:mm:ss',
+ stepHour: 2,
+ stepMinute: 10,
+ stepSecond: 10
+});
+
+
+
+
+
+
Add sliderAccess plugin for touch devices:
+
+
+
+
+$('#slider_example_3').datetimepicker({
+ addSliderAccess: true,
+ sliderAccessArgs: { touchonly: false }
+});
+
+
+
+
+
Use dropdowns instead of sliders. By default if slider is not available dropdowns will be used.
+
+
+
+
+$('#slider_example_4').datetimepicker({
+ controlType: 'select',
+ timeFormat: 'hh:mm tt'
+});
+
+
+
+
+
Uses one line dropdowns instead of sliders.
+
+
+
+
+$('#slider_example_4andHalf').datetimepicker({
+ controlType: 'select',
+ oneLine: true,
+ timeFormat: 'hh:mm tt'
+});
+
+
+
+
+
Create your own control by implementing the create, options, and value methods. If you want to use your new control for all instances use the $.timepicker.setDefaults({controlType:myControl}). Here we implement jQueryUI's spinner control (jQueryUI 1.9+).
+
+
+
+
var myControl= {
+ create: function(tp_inst, obj, unit, val, min, max, step){
+ $('<input class="ui-timepicker-input" value="'+val+'" style="width:50%">')
+ .appendTo(obj)
+ .spinner({
+ min: min,
+ max: max,
+ step: step,
+ change: function(e,ui){ // key events
+ // don't call if api was used and not key press
+ if(e.originalEvent !== undefined)
+ tp_inst._onTimeChange();
+ tp_inst._onSelectHandler();
+ },
+ spin: function(e,ui){ // spin events
+ tp_inst.control.value(tp_inst, obj, unit, ui.value);
+ tp_inst._onTimeChange();
+ tp_inst._onSelectHandler();
+ }
+ });
+ return obj;
+ },
+ options: function(tp_inst, obj, unit, opts, val){
+ if(typeof(opts) == 'string' && val !== undefined)
+ return obj.find('.ui-timepicker-input').spinner(opts, val);
+ return obj.find('.ui-timepicker-input').spinner(opts);
+ },
+ value: function(tp_inst, obj, unit, val){
+ if(val !== undefined)
+ return obj.find('.ui-timepicker-input').spinner('value', val);
+ return obj.find('.ui-timepicker-input').spinner('value');
+ }
+};
+
+$('#slider_example_5').datetimepicker({
+ controlType: myControl
+});
+
+
+
Alternate Fields
+
+
+
+
Alt field in the simplest form:
+
+
+
+
+
+$('#alt_example_1').datetimepicker({
+ altField: "#alt_example_1_alt"
+});
+
+
+
+
+
+
With datetime in both:
+
+
+
+
+
+$('#alt_example_2').datetimepicker({
+ altField: "#alt_example_2_alt",
+ altFieldTimeOnly: false
+});
+
+
+
+
+
+
Format the altField differently:
+
+
+
+
+
+$('#alt_example_3').datetimepicker({
+ altField: "#alt_example_3_alt",
+ altFieldTimeOnly: false,
+ altFormat: "yy-mm-dd",
+ altTimeFormat: "h:m t",
+ altSeparator: " @ "
+});
+
+
+
+
+
+
With inline mode using altField:
+
+
+
+
+
+$('#alt_example_4').datetimepicker({
+ altField: "#alt_example_4_alt",
+ altFieldTimeOnly: false
+});
+
+
+
+
+
+
+
+
Allows time displayed inside the picker to allow being typed in.
+
+
+
+
+$('#input_example_1').datetimepicker({
+ timeInput: true,
+ timeFormat: "hh:mm tt"
+});
+
+
+
+
+
+
Don't show any sliders, only the time input.
+
+
+
+
+$('#input_example_2').datetimepicker({
+ timeInput: true,
+ timeFormat: "hh:mm tt",
+ showHour: false,
+ showMinute: false
+});
+
+
+
+
Time Restraints
+
+
+
+
Set the min/max hour of every date:
+
+
+
+
+$('#rest_example_1').timepicker({
+ hourMin: 8,
+ hourMax: 16
+});
+
+
+
+
+
+
Set the min/max date numerically:
+
+
+
+
+$('#rest_example_2').datetimepicker({
+ numberOfMonths: 2,
+ minDate: 0,
+ maxDate: 30
+});
+
+
+
+
+
+
Set the min/max date and time with a Date object:
+
+
+
+
+$('#rest_example_3').datetimepicker({
+ minDate: new Date(2010, 11, 20, 8, 30),
+ maxDate: new Date(2010, 11, 31, 17, 30)
+});
+
+
+
+
+
Time Ranges
+
+
+
+
Restrict a start and end date by using onSelect and onClose events for more control over functionality:
+
For more examples and advanced usage grab the Handling Time eBook .
+
+
+
+
+
+var startDateTextBox = $('#range_example_1_start');
+var endDateTextBox = $('#range_example_1_end');
+
+startDateTextBox.datetimepicker({
+ timeFormat: 'HH:mm z',
+ onClose: function(dateText, inst) {
+ if (endDateTextBox.val() != '') {
+ var testStartDate = startDateTextBox.datetimepicker('getDate');
+ var testEndDate = endDateTextBox.datetimepicker('getDate');
+ if (testStartDate > testEndDate)
+ endDateTextBox.datetimepicker('setDate', testStartDate);
+ }
+ else {
+ endDateTextBox.val(dateText);
+ }
+ },
+ onSelect: function (selectedDateTime){
+ endDateTextBox.datetimepicker('option', 'minDate', startDateTextBox.datetimepicker('getDate') );
+ }
+});
+endDateTextBox.datetimepicker({
+ timeFormat: 'HH:mm z',
+ onClose: function(dateText, inst) {
+ if (startDateTextBox.val() != '') {
+ var testStartDate = startDateTextBox.datetimepicker('getDate');
+ var testEndDate = endDateTextBox.datetimepicker('getDate');
+ if (testStartDate > testEndDate)
+ startDateTextBox.datetimepicker('setDate', testEndDate);
+ }
+ else {
+ startDateTextBox.val(dateText);
+ }
+ },
+ onSelect: function (selectedDateTime){
+ startDateTextBox.datetimepicker('option', 'maxDate', endDateTextBox.datetimepicker('getDate') );
+ }
+});
+
+
+
+
+
+
Timepicker also includes some shortcut methods for ranges:
+
+
+
+
+
+var startDateTextBox = $('#range_example_2_start');
+var endDateTextBox = $('#range_example_2_end');
+
+$.timepicker.datetimeRange(
+ startDateTextBox,
+ endDateTextBox,
+ {
+ minInterval: (1000*60*60), // 1hr
+ dateFormat: 'dd M yy',
+ timeFormat: 'HH:mm',
+ start: {}, // start picker options
+ end: {} // end picker options
+ }
+);
+
+
+
+
+
+
To use only times for a time range use $.timepicker.timeRange():
+
+
+
+
+
+var startTimeTextBox = $('#range_example_3_start');
+var endTimeTextBox = $('#range_example_3_end');
+
+$.timepicker.timeRange(
+ startTimeTextBox,
+ endTimeTextBox,
+ {
+ minInterval: (1000*60*60), // 1hr
+ timeFormat: 'HH:mm',
+ start: {}, // start picker options
+ end: {} // end picker options
+ }
+);
+
+
+
+
+
+
Even though this plugin focuses on datetime, it also provides a dateRange function:
+
+
+
+
+
+var startDateTextBox = $('#range_example_4_start');
+var endDateTextBox = $('#range_example_4_end');
+
+$.timepicker.dateRange(
+ startDateTextBox,
+ endDateTextBox,
+ {
+ minInterval: (1000*60*60*24*4), // 4 days
+ maxInterval: (1000*60*60*24*8), // 8 days
+ start: {}, // start picker options
+ end: {} // end picker options
+ }
+);
+
+
+
+
Utilities
+
+
+
+
Get and Set Datetime with the getDate and setDate methods. This example uses timezone to demonstrate the timepicker regonizes the timezones and computes the offsets when getting and setting.
+
+
+ Set Datetime
+ Get Datetime
+
+
+
+var ex13 = $('#utility_example_1');
+
+ex13.datetimepicker({
+ timeFormat: 'hh:mm tt z',
+ separator: ' @ ',
+ showTimezone: true
+});
+
+$('#utility_example_1_setdt').click(function(){
+ ex13.datetimepicker('setDate', (new Date()) );
+});
+
+$('#utility_example_1_getdt').click(function(){
+ alert(ex13.datetimepicker('getDate'));
+});
+
+
+
+
+
+
Use the utility function to format your own time. $.datepicker.formatTime(format, time, options)
+
+ format required - string represenation of the time format to use
+ time required - hash: { hour, minute, second, millisecond, timezone }
+ options optional - hash of any options in regional translation (ampm, amNames, pmNames..)
+
+
Returns a time string in the specified format.
+
+
+
+$('#utility_example_2').text(
+ $.datepicker.formatTime('HH:mm z', { hour: 14, minute: 36, timezone: '+2000' }, {})
+);
+
+
+
+
+
+
Use the utility function to parses a formatted time. $.datepicker.parseTime(format, timeString, options)
+
+ format required - string represenation of the time format to use
+ time required - time string matching the format given in parameter 1
+ options optional - hash of any options in regional translation (ampm, amNames, pmNames..)
+
+
Returns an object with hours, minutes, seconds, milliseconds, timezone.
+
+
+
+$('#utility_example_3').text(JSON.stringify(
+ $.datepicker.parseTime('HH:mm:ss:l z', "14:36:21:765 +2000", {})
+));
+
+
diff --git a/src/docs/footer.html b/src/docs/footer.html
new file mode 100644
index 0000000..919cf65
--- /dev/null
+++ b/src/docs/footer.html
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+