Compare commits

...

79 Commits

Author SHA1 Message Date
Trent Richardson 5eb540282f Ready for deployment 2012-02-11 17:34:50 -05:00
Trent Richardson 19fa33319a he fix by erann3 2012-02-07 11:03:50 -05:00
Trent Richardson e9ac8bf8cf Korean by Genie 2012-02-07 10:56:46 -05:00
Trent Richardson 27a426e3eb Create public $.datepicker.formatTime method 2012-02-07 10:52:19 -05:00
Trent e2faad1db2 Trim formatted time for when ampm=false and tt in format 2012-01-30 15:49:09 -05:00
Trent 547e6adde3 timeFormat tt h:mm not parsed fix by clear00 2012-01-30 15:32:35 -05:00
Trent fc2531ff86 Merge branch 'master' of github.com:trentrichardson/jQuery-Timepicker-Addon into dev 2012-01-18 07:49:32 -05:00
Trent 1b96a3f1d2 Fix more semicolons 2012-01-11 11:38:28 -05:00
Trent f1e4a47170 Fix semicolons 2012-01-11 11:34:44 -05:00
Trent 4853a89b9d Fix beforeShow to return value - by kunalkumar 2011-12-27 15:18:26 -05:00
Trent 26776afeb2 Update Russian translation by Sanek 2011-12-19 10:12:49 -05:00
Trent Richardson 1a1526287a Merge pull request #284 from RichardBradley/dev
Fix error parsing date when setting option defaultDate
2011-12-15 08:27:25 -08:00
Richard Bradley 8e456626c7 bug fix - swallowing all date parsing errors breaks the datepicker option "defaultDate" on relative values like "-18y" 2011-12-15 15:33:22 +00:00
Trent 3ac151fe8c Check for tp_inst in gotoToday 2011-12-14 08:13:01 -05:00
Trent 0ec258f82b Added Norwegian translation 2011-12-06 10:57:13 -05:00
Trent Richardson 9af6f920e8 Fix option setter 2011-12-04 11:28:14 -05:00
Trent Richardson 0a68b5c5dc Merge pull request #278 from tomaswindsor/patch-1
Fixes option setter override so it doesn't break option getter.
2011-12-04 08:24:43 -08:00
Tomáš Windsor 21bcc3c07b Fixes option setter override so it doesn't break option getter. 2011-12-04 16:02:41 +01:00
Trent Richardson dc15bf6bc5 sliderAccess tweak 2011-12-04 09:48:06 -05:00
Trent Richardson ac38588138 sliderAccess tweak 2011-12-04 09:45:23 -05:00
Trent Richardson 9963f68ad5 Create new dev version 2011-12-03 15:26:14 -05:00
Trent Richardson cc45f6a6d8 Merge branch 'master' of github.com:trentrichardson/jQuery-Timepicker-Addon 2011-12-03 15:23:22 -05:00
Trent Richardson fc06b3fb2c Update Version 2011-12-03 15:10:50 -05:00
Trent Richardson 8c862700ca Prepare version update 2011-12-03 15:08:43 -05:00
Trent f7eafa9849 Adj grids only when slideAccess visible 2011-12-02 13:44:58 -05:00
Trent fab4a4428a Fix decimals results 2011-12-02 12:19:41 -05:00
Trent f9a9344e67 Fix grids with sliderAccess 2011-12-02 12:07:15 -05:00
Trent f4ace05108 Add sliderAccess integration 2011-12-02 11:05:04 -05:00
Trent 9a19d875ee refactor markup generation; add change event 2011-12-01 14:17:48 -05:00
Trent 97e6641ed8 Update Turkish translation by Goktug Ozturk 2011-11-23 11:36:51 -05:00
Trent 5b1a9af999 Added Swedish localization by Nevon 2011-11-01 09:05:01 -04:00
Trent f1b0f2cb1f Add translation by lalaships 2011-10-21 09:11:47 -04:00
Trent c75ff1c40c Fixes issue 254, 261 _updateDateTime 2011-10-18 10:08:49 -04:00
Trent 73adb692d0 Simplified Chinese by Will-Lu 2011-10-18 09:00:10 -04:00
Trent 5ee53c21b1 Fix daylight savings by mliberato 2011-10-18 08:53:32 -04:00
Trent Richardson fc29bd7277 Merge pull request #259 from inerdia/dev
Finished the Slovak localisation in the dev branch
2011-10-18 05:42:21 -07:00
Trent Richardson cc2b4dd91d Merge pull request #262 from davidbarral/dev
Added Galician translation
2011-10-18 05:40:57 -07:00
David Barral 52d21bd0fd Added Galician translation 2011-10-18 13:38:34 +02:00
David Vallner 20b0c0845f Fix Slovak localisation and add AM/PM markers 2011-10-13 01:47:44 +02:00
Trent ff6596d673 Fix localization 2011-10-03 16:50:41 -04:00
Trent e14e636698 Fix localization 2011-10-03 16:48:07 -04:00
Trent Richardson fae432b17d Updated Last Mod Date 2011-10-02 09:52:31 -04:00
Trent Richardson 4106d5e3b6 Create new dev version 2011-10-02 09:51:22 -04:00
Trent Richardson 9448760924 Change version 2011-10-02 09:45:01 -04:00
Trent Richardson be01e84c24 Updated css in js file 2011-10-02 09:27:42 -04:00
Trent Richardson 680c0255f6 Merge pull request #249 from novoj/dev
Issue when combining stepHours and minHour / maxHour
2011-10-02 06:23:40 -07:00
Trent Richardson 7d63691052 Added Slovak translation 2011-10-02 09:15:41 -04:00
Ing. Jan Novotný ed10d0650e Issue when specifying stepHour/stepMinute/stepSecond along with min and max limits. Modulo was computed in relation with midnight instead of min limit. Error usecase:
$('#example1').datetimepicker({
                    stepHour: 4,
                    hourMin: 9,
                    hourMax: 18
                });

Would make steps 9-13-16 instead of 9-13-17.
2011-09-26 22:10:14 +02:00
Trent 5cf74480af Added Brazilian Portuguese translation 2011-09-09 11:04:02 -04:00
Trent Richardson ab8e05fbdb Added Portuguese translation by luanlmd 2011-08-20 07:38:58 -04:00
Trent Richardson a390d9c5cc Merge pull request #232 from jun66j5/l10n-ampm
Support localized AM/PM markers
2011-08-19 13:54:12 -07:00
Jun Omae 412212c6b6 Adds `amNames`/`pmNames` for Finnish translation. 2011-08-19 21:06:36 +09:00
Jun Omae b61c3a4c55 Merge remote-tracking branch 'trentrichardson/dev' into l10n-ampm 2011-08-19 21:04:41 +09:00
Trent b30cc8d9b3 Added Finnish translation by paazmaya 2011-08-18 15:42:33 -04:00
Jun Omae 399d980f4e Merge remote-tracking branch 'trentrichardson/dev' into l10n-ampm 2011-08-15 23:04:57 +09:00
Trent Richardson 67386ec726 Merge pull request #228 from jun66j5/iso8601-tz
Support timezone designators in iso8601
2011-08-15 05:15:06 -07:00
Jun Omae 95ee51ea24 Add `amNames`/`pmNames` for Polish translation. 2011-08-15 15:59:30 +09:00
Jun Omae 97990e9657 Merge remote-tracking branch 'trentrichardson/dev' into l10n-ampm 2011-08-15 15:52:36 +09:00
Trent Richardson 00a2cad13b Merge pull request #230 from Cyb0org/dev
Dev - New Polish translation
2011-08-14 17:58:19 -07:00
Michał Pena 7eae959879 Added Polish translation by Michał Pena 2011-08-14 21:51:28 +02:00
Jun Omae 897bea1bbe Fixed "Now" button with iso8601. 2011-08-12 22:58:04 +09:00
Jun Omae ceabba803d Merge remote-tracking branch 'trentrichardson/dev' into iso8601-tz 2011-08-12 22:51:24 +09:00
Jun Omae 195be63853 Allow to input characters of localized AM/PM markers. 2011-08-12 22:07:10 +09:00
Jun Omae 9ee65b2428 Fixed broken locale-js for 'he'. 2011-08-12 22:03:18 +09:00
Trent Richardson 8507859312 Merge pull request #225 from jun66j5/dev
Now button should set the current timezone.
2011-08-12 05:43:04 -07:00
Jun Omae b7293ca2a5 When `showTimezone` is true, "Now" button sets the current timezone. 2011-08-12 19:09:22 +09:00
Jun Omae 5ab6e7bc7d Now button sets the current timezone. 2011-08-11 15:55:47 +09:00
Jun Omae cb98a45fd6 Support localized AM/PM markers. 2011-08-11 14:43:48 +09:00
Jun Omae 6737b60eee Support timezone designators in iso8601. 2011-08-09 21:25:08 +09:00
Trent Richardson 04efa5859c Add Romanian translation by myscienceisbetter 2011-07-28 17:58:52 -04:00
Trent Richardson 76dd5494cd Merge pull request #216 from jun66j5/translation-ja
Adding Japanese translations
2011-07-26 11:12:53 -07:00
Jun Omae fe5327c6ef Added Japanese translations 2011-07-27 01:55:51 +09:00
Trent Richardson 00b190aa48 Force type int of grid options 2011-07-25 07:14:51 -04:00
Trent Richardson 9fa3845513 Fix gotoToday button click 2011-07-24 16:13:16 -04:00
Trent Richardson 05baee4625 Updated translations to include Milliseconds. Please update if you see bad translations! 2011-07-24 10:07:00 -04:00
Trent Richardson a161235e97 Added millisecond functionality by Beakersoft 2011-07-23 11:10:54 -04:00
Trent Richardson 083efb98d5 Added Hebrew localization 2011-07-23 09:35:00 -04:00
Trent Richardson c7ff0ccd31 Added Catalan localization 2011-07-23 09:28:10 -04:00
Trent Richardson 4d9a8c45b5 Create 0.9.7-dev 2011-07-20 08:08:16 -04:00
31 changed files with 767 additions and 159 deletions

View File

@ -1,6 +1,6 @@
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
.ui-timepicker-div dl { text-align: left; }
.ui-timepicker-div dl dt { height: 25px; }
.ui-timepicker-div dl dd { margin: -25px 10px 10px 65px; }
.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; }

View File

@ -1,25 +1,26 @@
/*
* jQuery timepicker addon
* By: Trent Richardson [http://trentrichardson.com]
* Version 0.9.6
* Last Modified: 07/20/2011
* Version 0.9.9
* Last Modified: 02/05/2012
*
* Copyright 2011 Trent Richardson
* Copyright 2012 Trent Richardson
* Dual licensed under the MIT and GPL licenses.
* http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
* http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
*
* HERES THE CSS:
* .ui-timepicker-div .ui-widget-header{ margin-bottom: 8px; }
* .ui-timepicker-div dl{ text-align: left; }
* .ui-timepicker-div dl dt{ height: 25px; }
* .ui-timepicker-div dl dd{ margin: -25px 10px 10px 65px; }
* .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; }
*/
(function($) {
$.extend($.ui, { timepicker: { version: "0.9.6" } });
$.extend($.ui, { timepicker: { version: "0.9.9" } });
/* Time picker manager.
Use the singleton instance of this class, $.timepicker, to interact with the time picker.
@ -32,6 +33,8 @@ function Timepicker() {
currentText: 'Now',
closeText: 'Done',
ampm: false,
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
timeFormat: 'hh:mm tt',
timeSuffix: '',
timeOnlyTitle: 'Choose Time',
@ -39,6 +42,7 @@ function Timepicker() {
hourText: 'Hour',
minuteText: 'Minute',
secondText: 'Second',
millisecText: 'Millisecond',
timezoneText: 'Time Zone'
};
this._defaults = { // Global defaults for all the datetime picker instances
@ -47,37 +51,44 @@ function Timepicker() {
showHour: true,
showMinute: true,
showSecond: false,
showMillisec: false,
showTimezone: false,
showTime: true,
stepHour: 0.05,
stepMinute: 0.05,
stepSecond: 0.05,
stepHour: 1,
stepMinute: 1,
stepSecond: 1,
stepMillisec: 1,
hour: 0,
minute: 0,
second: 0,
millisec: 0,
timezone: '+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,
showTimepicker: true,
timezoneList: ["-1100", "-1000", "-0900", "-0800", "-0700", "-0600",
"-0500", "-0400", "-0300", "-0200", "-0100", "+0000",
"+0100", "+0200", "+0300", "+0400", "+0500", "+0600",
"+0700", "+0800", "+0900", "+1000", "+1100", "+1200"]
timezoneIso8609: false,
timezoneList: null,
addSliderAccess: false,
sliderAccessArgs: null
};
$.extend(this._defaults, this.regional['']);
}
};
$.extend(Timepicker.prototype, {
$input: null,
@ -87,25 +98,26 @@ $.extend(Timepicker.prototype, {
hour_slider: null,
minute_slider: null,
second_slider: null,
millisec_slider: null,
timezone_select: null,
hour: 0,
minute: 0,
second: 0,
millisec: 0,
timezone: '+0000',
hourMinOriginal: null,
minuteMinOriginal: null,
secondMinOriginal: null,
millisecMinOriginal: null,
hourMaxOriginal: null,
minuteMaxOriginal: null,
secondMaxOriginal: null,
millisecMaxOriginal: null,
ampm: '',
formattedDate: '',
formattedTime: '',
formattedDateTime: '',
timezoneList: ["-1100", "-1000", "-0900", "-0800", "-0700", "-0600",
"-0500", "-0400", "-0300", "-0200", "-0100", "+0000",
"+0100", "+0200", "+0300", "+0400", "+0500", "+0600",
"+0700", "+0800", "+0900", "+1000", "+1100", "+1200"],
timezoneList: null,
/* Override the default settings for all instances of the time picker.
@param settings object - the new settings to use as defaults (anonymous object)
@ -135,7 +147,7 @@ $.extend(Timepicker.prototype, {
tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, {
beforeShow: function(input, dp_inst) {
if ($.isFunction(o.beforeShow))
o.beforeShow(input, dp_inst, tp_inst);
return o.beforeShow(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.
@ -151,10 +163,24 @@ $.extend(Timepicker.prototype, {
},
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() });
if (tp_inst._defaults.timezoneList === null) {
var timezoneList = [];
for (var i = -11; i <= 12; i++)
timezoneList.push((i >= 0 ? '+' : '-') + ('0' + Math.abs(i).toString()).slice(-2) + '00');
if (tp_inst._defaults.timezoneIso8609)
timezoneList = $.map(timezoneList, function(val) {
return val == '+0000' ? 'Z' : (val.substring(0, 3) + ':' + val.substring(3));
});
tp_inst._defaults.timezoneList = timezoneList;
}
tp_inst.hour = tp_inst._defaults.hour;
tp_inst.minute = tp_inst._defaults.minute;
tp_inst.second = tp_inst._defaults.second;
tp_inst.millisec = tp_inst._defaults.millisec;
tp_inst.ampm = '';
tp_inst.$input = $input;
@ -162,7 +188,16 @@ $.extend(Timepicker.prototype, {
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());
@ -172,7 +207,6 @@ $.extend(Timepicker.prototype, {
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());
return tp_inst;
},
@ -197,10 +231,12 @@ $.extend(Timepicker.prototype, {
.replace(/h{1,2}/ig, '(\\d?\\d)')
.replace(/m{1,2}/ig, '(\\d?\\d)')
.replace(/s{1,2}/ig, '(\\d?\\d)')
.replace(/t{1,2}/ig, '(am|pm|a|p)?')
.replace(/z{1}/ig, '((\\+|-)\\d\\d\\d\\d)?')
.replace(/l{1}/ig, '(\\d?\\d?\\d)')
.replace(/t{1,2}/ig, this._getPatternAmpm())
.replace(/z{1}/ig, '(z|[-+]\\d\\d:?\\d\\d)?')
.replace(/\s/g, '\\s?') + this._defaults.timeSuffix + '$',
order = this._getFormatPositions(),
ampm = '',
treg;
if (!this.inst) this.inst = $.datepicker._getInst(this.$input[0]);
@ -211,28 +247,56 @@ $.extend(Timepicker.prototype, {
var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
// escape special regex characters in the seperator
var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g");
regstr = '.{' + dp_dateFormat.length + ',}' + this._defaults.separator.replace(specials, "\\$&") + regstr;
regstr = '^.{' + dp_dateFormat.length + ',}?' + this._defaults.separator.replace(specials, "\\$&") + regstr;
}
treg = timeString.match(new RegExp(regstr, 'i'));
if (treg) {
if (order.t !== -1)
this.ampm = ((treg[order.t] === undefined || treg[order.t].length === 0) ?
'' :
(treg[order.t].charAt(0).toUpperCase() == 'A') ? 'AM' : 'PM').toUpperCase();
if (order.t !== -1) {
if (treg[order.t] === undefined || treg[order.t].length === 0) {
ampm = '';
this.ampm = '';
} else {
ampm = $.inArray(treg[order.t].toUpperCase(), this.amNames) !== -1 ? 'AM' : 'PM';
this.ampm = this._defaults[ampm == 'AM' ? 'amNames' : 'pmNames'][0];
}
}
if (order.h !== -1) {
if (this.ampm == 'AM' && treg[order.h] == '12')
if (ampm == 'AM' && treg[order.h] == '12')
this.hour = 0; // 12am = 0 hour
else if (this.ampm == 'PM' && treg[order.h] != '12')
else if (ampm == 'PM' && treg[order.h] != '12')
this.hour = (parseFloat(treg[order.h]) + 12).toFixed(0); // 12pm = 12 hour, any other pm = hour + 12
else this.hour = Number(treg[order.h]);
}
if (order.m !== -1) this.minute = Number(treg[order.m]);
if (order.s !== -1) this.second = Number(treg[order.s]);
if (order.z !== -1) this.timezone = treg[order.z];
if (order.l !== -1) this.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 = this._defaults.timezoneIso8609 ? 'Z' : '+0000';
break;
case 5: // +hhmm
if (this._defaults.timezoneIso8609)
tz = tz.substring(1) == '0000'
? 'Z'
: tz.substring(0, 3) + ':' + tz.substring(3);
break;
case 6: // +hh:mm
if (!this._defaults.timezoneIso8609)
tz = tz == 'Z' || tz.substring(1) == '00:00'
? '+0000'
: tz.replace(/:/, '');
else if (tz.substring(1) == '00:00')
tz = 'Z';
break;
}
this.timezone = tz;
}
return true;
@ -240,12 +304,26 @@ $.extend(Timepicker.prototype, {
return false;
},
//########################################################################
// pattern for standard and localized AM/PM markers
//########################################################################
_getPatternAmpm: function() {
var markers = [];
o = this._defaults;
if (o.amNames)
$.merge(markers, o.amNames);
if (o.pmNames)
$.merge(markers, o.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
//########################################################################
_getFormatPositions: function() {
var finds = this._defaults.timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|t{1,2}|z)/g),
orders = { h: -1, m: -1, s: -1, t: -1, z: -1 };
var finds = this._defaults.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++)
@ -265,9 +343,10 @@ $.extend(Timepicker.prototype, {
// Added by Peter Medeiros:
// - Figure out what the hour/minute/second max should be based on the step values.
// - Example: if stepMinute is 15, then minMax is 45.
hourMax = (o.hourMax - (o.hourMax % o.stepHour)).toFixed(0),
minMax = (o.minuteMax - (o.minuteMax % o.stepMinute)).toFixed(0),
secMax = (o.secondMax - (o.secondMax % o.stepSecond)).toFixed(0),
hourMax = parseInt((o.hourMax - ((o.hourMax - o.hourMin) % o.stepHour)) ,10),
minMax = parseInt((o.minuteMax - ((o.minuteMax - o.minuteMin) % o.stepMinute)) ,10),
secMax = parseInt((o.secondMax - ((o.secondMax - o.secondMin) % o.stepSecond)) ,10),
millisecMax = parseInt((o.millisecMax - ((o.millisecMax - o.millisecMin) % o.stepMillisec)) ,10),
dp_id = this.inst.id.toString().replace(/([^A-Za-z0-9_])/g, '');
// Prevent displaying twice
@ -284,14 +363,16 @@ $.extend(Timepicker.prototype, {
hourGridSize = 0,
minuteGridSize = 0,
secondGridSize = 0,
millisecGridSize = 0,
size;
if (o.showHour && o.hourGrid > 0) {
html += '<dd class="ui_tpicker_hour">' +
'<div id="ui_tpicker_hour_' + dp_id + '"' + ((o.showHour) ? '' : noDisplay) + '></div>' +
'<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
for (var h = o.hourMin; h <= hourMax; h += o.hourGrid) {
// Hours
html += '<dd class="ui_tpicker_hour"><div id="ui_tpicker_hour_' + dp_id + '"' +
((o.showHour) ? '' : noDisplay) + '></div>';
if (o.showHour && o.hourGrid > 0) {
html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
for (var h = o.hourMin; h <= hourMax; h += parseInt(o.hourGrid,10)) {
hourGridSize++;
var tmph = (o.ampm && h > 12) ? h-12 : h;
if (tmph < 10) tmph = '0' + tmph;
@ -303,49 +384,65 @@ $.extend(Timepicker.prototype, {
html += '<td>' + tmph + '</td>';
}
html += '</tr></table></div>' +
'</dd>';
} else html += '<dd class="ui_tpicker_hour" id="ui_tpicker_hour_' + dp_id + '"' +
((o.showHour) ? '' : noDisplay) + '></dd>';
html += '</tr></table></div>';
}
html += '</dd>';
// Minutes
html += '<dt class="ui_tpicker_minute_label" id="ui_tpicker_minute_label_' + dp_id + '"' +
((o.showMinute) ? '' : noDisplay) + '>' + o.minuteText + '</dt>';
((o.showMinute) ? '' : noDisplay) + '>' + o.minuteText + '</dt>'+
'<dd class="ui_tpicker_minute"><div id="ui_tpicker_minute_' + dp_id + '"' +
((o.showMinute) ? '' : noDisplay) + '></div>';
if (o.showMinute && o.minuteGrid > 0) {
html += '<dd class="ui_tpicker_minute ui_tpicker_minute_' + o.minuteGrid + '">' +
'<div id="ui_tpicker_minute_' + dp_id + '"' +
((o.showMinute) ? '' : noDisplay) + '></div>' +
'<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
for (var m = o.minuteMin; m <= minMax; m += o.minuteGrid) {
for (var m = o.minuteMin; m <= minMax; m += parseInt(o.minuteGrid,10)) {
minuteGridSize++;
html += '<td>' + ((m < 10) ? '0' : '') + m + '</td>';
}
html += '</tr></table></div>' +
'</dd>';
} else html += '<dd class="ui_tpicker_minute" id="ui_tpicker_minute_' + dp_id + '"' +
((o.showMinute) ? '' : noDisplay) + '></dd>';
html += '</tr></table></div>';
}
html += '</dd>';
// Seconds
html += '<dt class="ui_tpicker_second_label" id="ui_tpicker_second_label_' + dp_id + '"' +
((o.showSecond) ? '' : noDisplay) + '>' + o.secondText + '</dt>';
((o.showSecond) ? '' : noDisplay) + '>' + o.secondText + '</dt>'+
'<dd class="ui_tpicker_second"><div id="ui_tpicker_second_' + dp_id + '"'+
((o.showSecond) ? '' : noDisplay) + '></div>';
if (o.showSecond && o.secondGrid > 0) {
html += '<dd class="ui_tpicker_second ui_tpicker_second_' + o.secondGrid + '">' +
'<div id="ui_tpicker_second_' + dp_id + '"' +
((o.showSecond) ? '' : noDisplay) + '></div>' +
'<div style="padding-left: 1px"><table><tr>';
html += '<div style="padding-left: 1px"><table><tr>';
for (var s = o.secondMin; s <= secMax; s += o.secondGrid) {
for (var s = o.secondMin; s <= secMax; s += parseInt(o.secondGrid,10)) {
secondGridSize++;
html += '<td>' + ((s < 10) ? '0' : '') + s + '</td>';
}
html += '</tr></table></div>' +
'</dd>';
} else html += '<dd class="ui_tpicker_second" id="ui_tpicker_second_' + dp_id + '"' +
((o.showSecond) ? '' : noDisplay) + '></dd>';
html += '</tr></table></div>';
}
html += '</dd>';
// Milliseconds
html += '<dt class="ui_tpicker_millisec_label" id="ui_tpicker_millisec_label_' + dp_id + '"' +
((o.showMillisec) ? '' : noDisplay) + '>' + o.millisecText + '</dt>'+
'<dd class="ui_tpicker_millisec"><div id="ui_tpicker_millisec_' + dp_id + '"'+
((o.showMillisec) ? '' : noDisplay) + '></div>';
if (o.showMillisec && o.millisecGrid > 0) {
html += '<div style="padding-left: 1px"><table><tr>';
for (var l = o.millisecMin; l <= millisecMax; l += parseInt(o.millisecGrid,10)) {
millisecGridSize++;
html += '<td>' + ((l < 10) ? '0' : '') + l + '</td>';
}
html += '</tr></table></div>';
}
html += '</dd>';
// Timezone
html += '<dt class="ui_tpicker_timezone_label" id="ui_tpicker_timezone_label_' + dp_id + '"' +
((o.showTimezone) ? '' : noDisplay) + '>' + o.timezoneText + '</dt>';
html += '<dd class="ui_tpicker_timezone" id="ui_tpicker_timezone_' + dp_id + '"' +
@ -375,6 +472,7 @@ $.extend(Timepicker.prototype, {
}
});
// Updated by Peter Medeiros:
// - Pass in Event and UI instance into slide function
this.minute_slider = $tp.find('#ui_tpicker_minute_'+ dp_id).slider({
@ -384,7 +482,6 @@ $.extend(Timepicker.prototype, {
max: minMax,
step: o.stepMinute,
slide: function(event, ui) {
// update the global minute slider instance value with the current slider value
tp_inst.minute_slider.slider( "option", "value", ui.value);
tp_inst._onTimeChange();
}
@ -401,8 +498,19 @@ $.extend(Timepicker.prototype, {
tp_inst._onTimeChange();
}
});
this.millisec_slider = $tp.find('#ui_tpicker_millisec_'+ dp_id).slider({
orientation: "horizontal",
value: this.millisec,
min: o.millisecMin,
max: millisecMax,
step: o.stepMillisec,
slide: function(event, ui) {
tp_inst.millisec_slider.slider( "option", "value", ui.value);
tp_inst._onTimeChange();
}
});
this.timezone_select = $tp.find('#ui_tpicker_timezone_'+ dp_id).append('<select></select>').find("select");
$.fn.append.apply(this.timezone_select,
$.map(o.timezoneList, function(val, idx) {
@ -487,6 +595,25 @@ $.extend(Timepicker.prototype, {
});
}
if (o.showMillisec && o.millisecGrid > 0) {
$tp.find(".ui_tpicker_millisec table").css({
width: size + "%",
marginLeft: (size / (-2 * millisecGridSize)) + "%",
borderCollapse: 'collapse'
}).find("td").each(function(index) {
$(this).click(function() {
tp_inst.millisec_slider.slider("option", "value", $(this).html());
tp_inst._onTimeChange();
tp_inst._onSelectHandler();
}).css({
cursor: 'pointer',
width: (100 / millisecGridSize) + '%',
textAlign: 'center',
overflow: 'hidden'
});
});
}
var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
if ($buttonPanel.length) $buttonPanel.before($tp);
else $dp.append($tp);
@ -506,11 +633,38 @@ $.extend(Timepicker.prototype, {
this.hour_slider.bind('slidestop',onSelectDelegate);
this.minute_slider.bind('slidestop',onSelectDelegate);
this.second_slider.bind('slidestop',onSelectDelegate);
this.millisec_slider.bind('slidestop',onSelectDelegate);
// slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
if (this._defaults.addSliderAccess){
var sliderAccessArgs = this._defaults.sliderAccessArgs;
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('marginLeft').toString().replace('%',''),
newWidth = oldWidth - sliderAccessWidth,
newMarginLeft = ((oldMarginLeft * newWidth)/oldWidth) + '%';
$g.css({ width: newWidth, marginLeft: newMarginLeft });
});
}
}
},0);
}
// end slideAccess integration
}
},
//########################################################################
// This function tries to limit the ability to go outside the
// This function tries to limit the ability to go outside the
// min/max date range
//########################################################################
_limitMinMaxDateTime: function(dp_inst, adjustSliders){
@ -519,14 +673,15 @@ $.extend(Timepicker.prototype, {
if(!this._defaults.showTimepicker) return; // No time so nothing to check here
if($.datepicker._get(dp_inst, 'minDateTime') !== null && dp_date){
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){
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()) {
@ -537,29 +692,36 @@ $.extend(Timepicker.prototype, {
if (this.minute <= this._defaults.minuteMin) {
this.minute = this._defaults.minuteMin;
this._defaults.secondMin = minDateTime.getSeconds();
} else if (this.second <= this._defaults.secondMin){
this.second = this._defaults.secondMin;
this._defaults.millisecMin = minDateTime.getMilliseconds();
} else {
if(this.second < this._defaults.secondMin) this.second = this._defaults.secondMin;
this._defaults.secondMin = this.secondMinOriginal;
if(this.millisec < this._defaults.millisecMin)
this.millisec = this._defaults.millisecMin;
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 && dp_date){
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()){
@ -570,25 +732,31 @@ $.extend(Timepicker.prototype, {
if (this.minute >= this._defaults.minuteMax) {
this.minute = this._defaults.minuteMax;
this._defaults.secondMax = maxDateTime.getSeconds();
} else if (this.second >= this._defaults.secondMax) {
this.second = this._defaults.secondMax;
this._defaults.millisecMax = maxDateTime.getMilliseconds();
} else {
if(this.second > this._defaults.secondMax) this.second = this._defaults.secondMax;
this._defaults.secondMax = this.secondMaxOriginal;
if(this.millisec > this._defaults.millisecMax) this.millisec = this._defaults.millisecMax;
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 = (this._defaults.hourMax - (this._defaults.hourMax % this._defaults.stepHour)).toFixed(0),
minMax = (this._defaults.minuteMax - (this._defaults.minuteMax % this._defaults.stepMinute)).toFixed(0),
secMax = (this._defaults.secondMax - (this._defaults.secondMax % this._defaults.stepSecond)).toFixed(0);
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.hour_slider.slider("option", { min: this._defaults.hourMin, max: hourMax }).slider('value', this.hour);
@ -596,6 +764,8 @@ $.extend(Timepicker.prototype, {
this.minute_slider.slider("option", { min: this._defaults.minuteMin, max: minMax }).slider('value', this.minute);
if(this.second_slider)
this.second_slider.slider("option", { min: this._defaults.secondMin, max: secMax }).slider('value', this.second);
if(this.millisec_slider)
this.millisec_slider.slider("option", { min: this._defaults.millisecMin, max: millisecMax }).slider('value', this.millisec);
}
},
@ -609,38 +779,48 @@ $.extend(Timepicker.prototype, {
var hour = (this.hour_slider) ? this.hour_slider.slider('value') : false,
minute = (this.minute_slider) ? this.minute_slider.slider('value') : false,
second = (this.second_slider) ? this.second_slider.slider('value') : false,
timezone = (this.timezone_select) ? this.timezone_select.val() : false;
millisec = (this.millisec_slider) ? this.millisec_slider.slider('value') : false,
timezone = (this.timezone_select) ? this.timezone_select.val() : false,
o = this._defaults;
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 = (hour < 12) ? 'AM' : 'PM';
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 || (this.ampm.length > 0 && this.ampm != ampm) || timezone != this.timezone);
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))
|| 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 (this._defaults.ampm) this.ampm = ampm;
if (o.ampm) this.ampm = ampm;
this._formatTime();
if (this.$timeObj) this.$timeObj.text(this.formattedTime + this._defaults.timeSuffix);
//this._formatTime();
this.formattedTime = $.datepicker.formatTime(this._defaults.timeFormat, this, this._defaults);
if (this.$timeObj) this.$timeObj.text(this.formattedTime + o.timeSuffix);
this.timeDefined = true;
if (hasChanged) this._updateDateTime();
},
@ -650,7 +830,7 @@ $.extend(Timepicker.prototype, {
// bind to sliders slidestop, and grid click.
//########################################################################
_onSelectHandler: function() {
var onSelect = this._defaults['onSelect'];
var onSelect = this._defaults.onSelect;
var inputEl = this.$input ? this.$input[0] : null;
if (onSelect && inputEl) {
onSelect.apply(inputEl, [this.formattedDateTime, this]);
@ -658,42 +838,14 @@ $.extend(Timepicker.prototype, {
},
//########################################################################
// format the time all pretty...
// left for any backwards compatibility
//########################################################################
_formatTime: function(time, format, ampm) {
if (ampm == undefined) ampm = this._defaults.ampm;
time = time || { hour: this.hour, minute: this.minute, second: this.second, ampm: this.ampm, timezone: this.timezone };
var tmptime = format || this._defaults.timeFormat.toString();
if (ampm) {
var hour12 = ((time.ampm == 'AM') ? (time.hour) : (time.hour % 12));
hour12 = (Number(hour12) === 0) ? 12 : hour12;
tmptime = tmptime.toString()
.replace(/hh/g, ((hour12 < 10) ? '0' : '') + hour12)
.replace(/h/g, hour12)
.replace(/mm/g, ((time.minute < 10) ? '0' : '') + time.minute)
.replace(/m/g, time.minute)
.replace(/ss/g, ((time.second < 10) ? '0' : '') + time.second)
.replace(/s/g, time.second)
.replace(/TT/g, time.ampm.toUpperCase())
.replace(/Tt/g, time.ampm.toUpperCase())
.replace(/tT/g, time.ampm.toLowerCase())
.replace(/tt/g, time.ampm.toLowerCase())
.replace(/T/g, time.ampm.charAt(0).toUpperCase())
.replace(/t/g, time.ampm.charAt(0).toLowerCase())
.replace(/z/g, time.timezone);
} else {
tmptime = tmptime.toString()
.replace(/hh/g, ((time.hour < 10) ? '0' : '') + time.hour)
.replace(/h/g, time.hour)
.replace(/mm/g, ((time.minute < 10) ? '0' : '') + time.minute)
.replace(/m/g, time.minute)
.replace(/ss/g, ((time.second < 10) ? '0' : '') + time.second)
.replace(/s/g, time.second)
.replace(/z/g, time.timezone);
tmptime = $.trim(tmptime.replace(/t/gi, ''));
}
_formatTime: function(time, format) {
time = time || { hour: this.hour, minute: this.minute, second: this.second, millisec: this.millisec, ampm: this.ampm, timezone: this.timezone };
var tmptime = (format || this._defaults.timeFormat).toString();
tmptime = $.datepicker.formatTime(tmptime, time, this._defaults);
if (arguments.length) return tmptime;
else this.formattedTime = tmptime;
},
@ -702,8 +854,8 @@ $.extend(Timepicker.prototype, {
// update our input with the new date time..
//########################################################################
_updateDateTime: function(dp_inst) {
dp_inst = this.inst || dp_inst,
dt = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay),
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;
@ -777,6 +929,54 @@ $.fn.extend({
}
});
//########################################################################
// format the time all pretty...
// 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;
var ampmName = options['amNames'][0];
var hour = parseInt(time.hour, 10);
if (options.ampm) {
if (hour > 11){
ampmName = options['pmNames'][0];
if(hour > 12)
hour = hour % 12;
}
if (hour === 0)
hour = 12;
}
tmptime = tmptime.replace(/(?:hh?|mm?|ss?|[tT]{1,2}|[lz])/g, function(match) {
switch (match.toLowerCase()) {
case 'hh': return ('0' + hour).slice(-2);
case 'h': return 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;
case 't': case 'tt':
if (options.ampm) {
if (match.length == 1)
ampmName = ampmName.charAt(0);
return match.charAt(0) == 'T' ? ampmName.toUpperCase() : ampmName.toLowerCase();
}
return '';
}
});
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
@ -790,7 +990,7 @@ $.datepicker._selectDate = function (id, dateStr) {
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 + tp_inst._defaults.separator + tp_inst.formattedTime + tp_inst._defaults.timeSuffix);
this._base_selectDate(id, dateStr);
inst.inline = inst.stay_open = false;
this._notifyChange(inst);
this._updateDatepicker(inst);
@ -848,6 +1048,8 @@ $.datepicker._doKeyPress = function(event) {
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);
@ -884,8 +1086,23 @@ $.datepicker._doKeyUp = function (event) {
//#######################################################################################
$.datepicker._base_gotoToday = $.datepicker._gotoToday;
$.datepicker._gotoToday = function(id) {
var inst = this._getInst($(id)[0]),
$dp = inst.dpDiv;
this._base_gotoToday(id);
this._setTime(this._getInst($(id)[0]), new Date());
var now = new Date();
var tp_inst = this._get(inst, 'timepicker');
if (tp_inst && tp_inst._defaults.showTimezone && tp_inst.timezone_select) {
var tzoffset = now.getTimezoneOffset(); // If +0100, returns -60
var tzsign = tzoffset > 0 ? '-' : '+';
tzoffset = Math.abs(tzoffset);
var tzmin = tzoffset % 60;
tzoffset = tzsign + ('0' + (tzoffset - tzmin) / 60).slice(-2) + ('0' + tzmin).slice(-2);
if (tp_inst._defaults.timezoneIso8609)
tzoffset = tzoffset.substring(0, 3) + ':' + tzoffset.substring(3);
tp_inst.timezone_select.val(tzoffset);
}
this._setTime(inst, now);
$( '.ui-datepicker-today', $dp).click();
};
//#######################################################################################
@ -922,22 +1139,26 @@ $.datepicker._setTime = function(inst, date) {
// calling _setTime with no date sets time to defaults
hour = date ? date.getHours() : defaults.hour,
minute = date ? date.getMinutes() : defaults.minute,
second = date ? date.getSeconds() : defaults.second;
second = date ? date.getSeconds() : defaults.second,
millisec = date ? date.getMilliseconds() : defaults.millisec;
//check if within min/max times..
if ((hour < defaults.hourMin || hour > defaults.hourMax) || (minute < defaults.minuteMin || minute > defaults.minuteMax) || (second < defaults.secondMin || second > defaults.secondMax)) {
if ((hour < defaults.hourMin || hour > defaults.hourMax) || (minute < defaults.minuteMin || minute > defaults.minuteMax) || (second < defaults.secondMin || second > defaults.secondMax) || (millisec < defaults.millisecMin || millisec > defaults.millisecMax)) {
hour = defaults.hourMin;
minute = defaults.minuteMin;
second = defaults.secondMin;
millisec = defaults.millisecMin;
}
tp_inst.hour = hour;
tp_inst.minute = minute;
tp_inst.second = second;
tp_inst.millisec = millisec;
if (tp_inst.hour_slider) tp_inst.hour_slider.slider('value', hour);
if (tp_inst.minute_slider) tp_inst.minute_slider.slider('value', minute);
if (tp_inst.second_slider) tp_inst.second_slider.slider('value', second);
if (tp_inst.millisec_slider) tp_inst.millisec_slider.slider('value', millisec);
tp_inst._onTimeChange();
tp_inst._updateDateTime(inst);
@ -958,7 +1179,7 @@ $.datepicker._setTimeDatepicker = function(target, date, withDate) {
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_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;
@ -992,7 +1213,7 @@ $.datepicker._getDateDatepicker = function(target, noDefault) {
if (tp_inst) {
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);
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);
@ -1008,39 +1229,83 @@ $.datepicker.parseDate = function(format, value, settings) {
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);
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.
date = this._base_parseDate(format, value.substring(0,value.length-(err.length-err.indexOf(':')-2)), settings);
} else {
// The underlying error was not related to the time
throw err;
}
}
return date;
};
//#######################################################################################
// override options setter to add time to maxDate(Time) and minDate(Time)
// 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)
{
if(day)
var b = this._base_formatDate(inst, day, month, year);
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) {
this._base_optionDatepicker(target, name, value);
var inst = this._getInst(target),
tp_inst = this._get(inst, 'timepicker');
if (tp_inst) {
//Set minimum and maximum date values if we have timepicker
if(name==='minDate') {
if(tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date)
tp_inst._defaults.minDateTime = new Date(value);
if(tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date)
tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
tp_inst._limitMinMaxDateTime(inst,true);
var min,max,onselect;
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 (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;
}
if(name==='maxDate') {
if(tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date)
tp_inst._defaults.maxDateTime = new Date(value);
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._limitMinMaxDateTime(inst,true);
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(target, name);
return this._base_optionDatepicker(target, name, value);
};
//#######################################################################################
@ -1052,9 +1317,10 @@ function extendRemove(target, props) {
if (props[name] === null || props[name] === undefined)
target[name] = props[name];
return target;
}
};
$.timepicker = new Timepicker(); // singleton instance
$.timepicker.version = "0.9.6";
$.timepicker.version = "0.9.9";
})(jQuery);

20
localization/jquery-ui-timepicker-ca.js vendored Normal file
View File

@ -0,0 +1,20 @@
/* Catalan translation for the jQuery Timepicker Addon */
/* Written by Sergi Faber */
(function($) {
$.timepicker.regional['ca'] = {
timeOnlyTitle: 'Escollir una hora',
timeText: 'Hora',
hourText: 'Hores',
minuteText: 'Minuts',
secondText: 'Segons',
millisecText: 'Milisegons',
timezoneText: 'Fus horari',
currentText: 'Ara',
closeText: 'Tancar',
timeFormat: 'hh:mm',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['ca']);
})(jQuery);

View File

@ -7,10 +7,13 @@
hourText: 'Hodiny',
minuteText: 'Minuty',
secondText: 'Vteřiny',
millisecText: 'Milisekundy',
timezoneText: 'Časové pásmo',
currentText: 'Nyní',
closeText: 'Zavřít',
timeFormat: 'h:m',
amNames: ['dop.', 'AM', 'A'],
pmNames: ['odp.', 'PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['cs']);

View File

@ -7,10 +7,13 @@
hourText: 'Stunde',
minuteText: 'Minute',
secondText: 'Sekunde',
millisecText: 'Millisekunde',
timezoneText: 'Zeitzone',
currentText: 'Jetzt',
closeText: 'Fertig',
timeFormat: 'hh:mm tt',
amNames: ['vorm.', 'AM', 'A'],
pmNames: ['nachm.', 'PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['de']);

View File

@ -7,10 +7,13 @@
hourText: 'Ώρες',
minuteText: 'Λεπτά',
secondText: 'Δευτερόλεπτα',
millisecText: 'μιλιδευτερόλεπτο',
timezoneText: 'Ζώνη ώρας',
currentText: 'Τώρα',
closeText: 'Κλείσιμο',
timeFormat: 'hh:mm',
amNames: ['π.μ.', 'AM', 'A'],
pmNames: ['μ.μ.', 'PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['el']);

View File

@ -7,10 +7,13 @@
hourText: 'Horas',
minuteText: 'Minutos',
secondText: 'Segundos',
millisecText: 'Milisegundos',
timezoneText: 'Huso horario',
currentText: 'Ahora',
closeText: 'Cerrar',
timeFormat: 'hh:mm',
amNames: ['a.m.', 'AM', 'A'],
pmNames: ['p.m.', 'PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['es']);

View File

@ -7,10 +7,13 @@
hourText: 'Tund',
minuteText: 'Minut',
secondText: 'Sekund',
millisecText: 'Millisekundis',
timezoneText: 'Ajavöönd',
currentText: 'Praegu',
closeText: 'Valmis',
timeFormat: 'hh:mm tt',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['et']);

20
localization/jquery-ui-timepicker-fi.js vendored Normal file
View File

@ -0,0 +1,20 @@
/* Finnish translation for the jQuery Timepicker Addon */
/* Written by Juga Paazmaya (http://github.com/paazmaya) */
(function($) {
$.timepicker.regional['fi'] = {
timeOnlyTitle: 'Valitse aika',
timeText: 'Aika',
hourText: 'Tunti',
minuteText: 'Minuutti',
secondText: 'Sekunti',
millisecText: 'Millisekunnin',
timezoneText: 'Aikavyöhyke',
currentText: 'Nyt',
closeText: 'Sulje',
timeFormat: 'hh:mm',
amNames: ['ap.', 'AM', 'A'],
pmNames: ['ip.', 'PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['fi']);
})(jQuery);

View File

@ -7,10 +7,13 @@
hourText: 'Heures',
minuteText: 'Minutes',
secondText: 'Secondes',
millisecText: 'Millisecondes',
timezoneText: 'Fuseau horaire',
currentText: 'Maintenant',
closeText: 'Terminé',
timeFormat: 'hh:mm',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['fr']);

20
localization/jquery-ui-timepicker-gl.js vendored Normal file
View File

@ -0,0 +1,20 @@
/* Galician translation for the jQuery Timepicker Addon */
/* Written by David Barral */
(function($) {
$.timepicker.regional['gl'] = {
timeOnlyTitle: 'Elixir unha hora',
timeText: 'Hora',
hourText: 'Horas',
minuteText: 'Minutos',
secondText: 'Segundos',
millisecText: 'Milisegundos',
timezoneText: 'Fuso horario',
currentText: 'Agora',
closeText: 'Pechar',
timeFormat: 'hh:mm',
amNames: ['a.m.', 'AM', 'A'],
pmNames: ['p.m.', 'PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['gl']);
})(jQuery);

20
localization/jquery-ui-timepicker-he.js vendored Normal file
View File

@ -0,0 +1,20 @@
/* Hebrew translation for the jQuery Timepicker Addon */
/* Written by Lior Lapid */
(function($) {
$.timepicker.regional["he"] = {
timeOnlyTitle: "בחירת זמן",
timeText: "שעה",
hourText: "שעות",
minuteText: "דקות",
secondText: "שניות",
millisecText: "אלפית השנייה",
timezoneText: "אזור זמן",
currentText: "עכשיו",
closeText:"סגור",
timeFormat: "hh:mm tt",
amNames: ['לפנה"צ', 'AM', 'A'],
pmNames: ['אחה"צ', 'PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional["he"]);
})(jQuery);

View File

@ -7,10 +7,13 @@
hourText: 'Óra',
minuteText: 'Perc',
secondText: 'Másodperc',
millisecText: 'Milliszekundumos',
timezoneText: 'Időzóna',
currentText: 'Most',
closeText: 'Kész',
timeFormat: 'hh:mm tt',
amNames: ['de.', 'AM', 'A'],
pmNames: ['du.', 'PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['hu']);

View File

@ -7,10 +7,13 @@
hourText: 'Pukul',
minuteText: 'Menit',
secondText: 'Detik',
millisecText: 'Milidetik',
timezoneText: 'Zona Waktu',
currentText: 'Sekarang',
closeText: 'OK',
timeFormat: 'hh:mm tt',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['id']);

View File

@ -7,10 +7,13 @@
hourText: 'Ora',
minuteText: 'Minuto',
secondText: 'Secondo',
millisecText: 'Millisecondo',
timezoneText: 'Fuso orario',
currentText: 'Adesso',
closeText: 'Chiudi',
timeFormat: 'hh:mm',
amNames: ['m.', 'AM', 'A'],
pmNames: ['p.', 'PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['it']);

20
localization/jquery-ui-timepicker-ja.js vendored Normal file
View File

@ -0,0 +1,20 @@
/* Japanese translation for the jQuery Timepicker Addon */
/* Written by Jun Omae */
(function($) {
$.timepicker.regional['ja'] = {
timeOnlyTitle: '時間を選択',
timeText: '時間',
hourText: '時',
minuteText: '分',
secondText: '秒',
millisecText: 'ミリ秒',
timezoneText: 'タイムゾーン',
currentText: '現時刻',
closeText: '閉じる',
timeFormat: 'hh:mm tt',
amNames: ['午前', 'AM', 'A'],
pmNames: ['午後', 'PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['ja']);
})(jQuery);

20
localization/jquery-ui-timepicker-ko.js vendored Normal file
View File

@ -0,0 +1,20 @@
/* Korean translation for the jQuery Timepicker Addon */
/* Written by Genie */
(function($) {
$.timepicker.regional['ko'] = {
timeOnlyTitle: '시간 선택',
timeText: '시간',
hourText: '시',
minuteText: '분',
secondText: '초',
millisecText: '밀리초',
timezoneText: '표준 시간대',
currentText: '현재 시각',
closeText: '닫기',
timeFormat: 'tt h:mm',
amNames: ['오전', 'AM', 'A'],
pmNames: ['오후', 'PM', 'P'],
ampm: true
};
$.timepicker.setDefaults($.timepicker.regional['ko']);
})(jQuery);

View File

@ -7,10 +7,13 @@
hourText: 'Valandos',
minuteText: 'Minutės',
secondText: 'Sekundės',
millisecText: 'Milisekundės',
timezoneText: 'Laiko zona',
currentText: 'Dabar',
closeText: 'Uždaryti',
timeFormat: 'hh:mm',
amNames: ['priešpiet', 'AM', 'A'],
pmNames: ['popiet', 'PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['lt']);

View File

@ -7,10 +7,13 @@
hourText: 'Uur',
minuteText: 'Minuut',
secondText: 'Seconde',
millisecText: 'Milliseconde',
timezoneText: 'Tijdzone',
currentText: 'Vandaag',
closeText: 'Sluiten',
timeFormat: 'hh:mm tt',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['nl']);

20
localization/jquery-ui-timepicker-no.js vendored Normal file
View File

@ -0,0 +1,20 @@
/* Norwegian translation for the jQuery Timepicker Addon */
/* Written by Morten Hauan (http://hauan.me) */
(function($) {
$.timepicker.regional['no'] = {
timeOnlyTitle: 'Velg tid',
timeText: 'Tid',
hourText: 'Time',
minuteText: 'Minutt',
secondText: 'Sekund',
millisecText: 'Millisekund',
timezoneText: 'Tidssone',
currentText: 'Nå',
closeText: 'Lukk',
timeFormat: 'hh:mm',
amNames: ['am', 'AM', 'A'],
pmNames: ['pm', 'PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['no']);
})(jQuery);

20
localization/jquery-ui-timepicker-pl.js vendored Normal file
View File

@ -0,0 +1,20 @@
/* Polish translation for the jQuery Timepicker Addon */
/* Written by Michał Pena */
(function($) {
$.timepicker.regional['pl'] = {
timeOnlyTitle: 'Wybierz godzinę',
timeText: 'Czas',
hourText: 'Godzina',
minuteText: 'Minuta',
secondText: 'Sekunda',
millisecText: 'Milisekunda',
timezoneText: 'Strefa czasowa',
currentText: 'Teraz',
closeText: 'Gotowe',
timeFormat: 'hh:mm tt',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['pl']);
})(jQuery);

View File

@ -0,0 +1,20 @@
/* Brazilian Portuguese translation for the jQuery Timepicker Addon */
/* Written by Diogo Damiani (diogodamiani@gmail.com) */
(function ($) {
$.timepicker.regional['pt-BR'] = {
timeOnlyTitle: 'Escolha a hora',
timeText: 'Hora',
hourText: 'Horas',
minuteText: 'Minutos',
secondText: 'Segundos',
millisecText: 'Milissegundos',
timezoneText: 'Fuso horário',
currentText: 'Agora',
closeText: 'Fechar',
timeFormat: 'hh:mm',
amNames: ['a.m.', 'AM', 'A'],
pmNames: ['p.m.', 'PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['pt-BR']);
})(jQuery);

20
localization/jquery-ui-timepicker-pt.js vendored Normal file
View File

@ -0,0 +1,20 @@
/* Portuguese translation for the jQuery Timepicker Addon */
/* Written by Luan Almeida */
(function($) {
$.timepicker.regional['pt'] = {
timeOnlyTitle: 'Escolha uma hora',
timeText: 'Hora',
hourText: 'Horas',
minuteText: 'Minutos',
secondText: 'Segundos',
millisecText: 'Milissegundos',
timezoneText: 'Fuso horário',
currentText: 'Agora',
closeText: 'Fechar',
timeFormat: 'hh:mm',
amNames: ['a.m.', 'AM', 'A'],
pmNames: ['p.m.', 'PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['pt']);
})(jQuery);

20
localization/jquery-ui-timepicker-ro.js vendored Normal file
View File

@ -0,0 +1,20 @@
/* Romanian translation for the jQuery Timepicker Addon */
/* Written by Romeo Adrian Cioaba */
(function($) {
$.timepicker.regional['ro'] = {
timeOnlyTitle: 'Alegeţi o oră',
timeText: 'Timp',
hourText: 'Ore',
minuteText: 'Minute',
secondText: 'Secunde',
millisecText: 'Milisecunde',
timezoneText: 'Fus orar',
currentText: 'Acum',
closeText: 'Închide',
timeFormat: 'hh:mm',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['ro']);
})(jQuery);

View File

@ -7,10 +7,13 @@
hourText: 'Часы',
minuteText: 'Минуты',
secondText: 'Секунды',
timezoneText: 'Время зоны',
currentText: 'Теперь',
millisecText: 'Миллисекунды',
timezoneText: 'Часовой пояс',
currentText: 'Сейчас',
closeText: 'Закрыть',
timeFormat: 'hh:mm tt',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['ru']);

20
localization/jquery-ui-timepicker-sk.js vendored Normal file
View File

@ -0,0 +1,20 @@
/* Slovak translation for the jQuery Timepicker Addon */
/* Written by David Vallner */
(function($) {
$.timepicker.regional['sk'] = {
timeOnlyTitle: 'Zvoľte čas',
timeText: 'Čas',
hourText: 'Hodiny',
minuteText: 'Minúty',
secondText: 'Sekundy',
millisecText: 'Milisekundy',
timezoneText: 'Časové pásmo',
currentText: 'Teraz',
closeText: 'Zavrieť',
timeFormat: 'h:m',
amNames: ['dop.', 'AM', 'A'],
pmNames: ['pop.', 'PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['sk']);
})(jQuery);

20
localization/jquery-ui-timepicker-sv.js vendored Normal file
View File

@ -0,0 +1,20 @@
/* Swedish translation for the jQuery Timepicker Addon */
/* Written by Nevon */
(function($) {
$.timepicker.regional['sv'] = {
timeOnlyTitle: 'Välj en tid',
timeText: 'Timme',
hourText: 'Timmar',
minuteText: 'Minuter',
secondText: 'Sekunder',
millisecText: 'Millisekunder',
timezoneText: 'Tidszon',
currentText: 'Nu',
closeText: 'Stäng',
timeFormat: 'hh:mm',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['sv']);
})(jQuery);

View File

@ -1,5 +1,5 @@
/* Turkish translation for the jQuery Timepicker Addon */
/* Written by Fehmi Can Saglam */
/* Written by Fehmi Can Saglam, Edited by Goktug Ozturk */
(function($) {
$.timepicker.regional['tr'] = {
timeOnlyTitle: 'Zaman Seçiniz',
@ -7,10 +7,13 @@
hourText: 'Saat',
minuteText: 'Dakika',
secondText: 'Saniye',
millisecText: 'Milisaniye',
timezoneText: 'Zaman Dilimi',
currentText: 'Şu an',
closeText: 'Tamam',
timeFormat: 'hh:mm',
amNames: ['ÖÖ', 'Ö'],
pmNames: ['ÖS', 'S'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['tr']);

View File

@ -7,10 +7,13 @@
hourText: 'Giờ',
minuteText: 'Phút',
secondText: 'Giây',
millisecText: 'Phần nghìn giây',
timezoneText: 'Múi giờ',
currentText: 'Hiện thời',
closeText: 'Đóng'
timeFormat: 'h:m',
amNames: ['SA', 'AM', 'A'],
pmNames: ['CH', 'PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['vi']);

View File

@ -0,0 +1,20 @@
/* Simplified Chinese translation for the jQuery Timepicker Addon /
/ Written by Will Lu */
(function($) {
$.timepicker.regional['zh-CN'] = {
timeOnlyTitle: '选择时间',
timeText: '时间',
hourText: '小时',
minuteText: '分钟',
secondText: '秒钟',
millisecText: '微秒',
timezoneText: '时区',
currentText: '现在时间',
closeText: '关闭',
timeFormat: 'hh:mm',
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['zh-CN']);
})(jQuery);

View File

@ -0,0 +1,20 @@
/* Chinese translation for the jQuery Timepicker Addon */
/* Written by Alang.lin */
(function($) {
$.timepicker.regional['zh-TW'] = {
timeOnlyTitle: '選擇時分秒',
timeText: '時間',
hourText: '時',
minuteText: '分',
secondText: '秒',
millisecText: '毫秒',
timezoneText: '時區',
currentText: '現在時間',
closeText: '確定',
timeFormat: 'hh:mm tt',
amNames: ['上午', 'AM', 'A'],
pmNames: ['下午', 'PM', 'P'],
ampm: false
};
$.timepicker.setDefaults($.timepicker.regional['zh-TW']);
})(jQuery);