Merge remote-tracking branch 'trentrichardson/dev' into l10n-ampm

This commit is contained in:
Jun Omae 2011-08-15 23:04:57 +09:00
commit 399d980f4e

View file

@ -81,10 +81,8 @@ function Timepicker() {
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
};
$.extend(this._defaults, this.regional['']);
}
@ -116,10 +114,7 @@ $.extend(Timepicker.prototype, {
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)
@ -168,6 +163,17 @@ $.extend(Timepicker.prototype, {
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;
@ -224,7 +230,7 @@ $.extend(Timepicker.prototype, {
.replace(/s{1,2}/ig, '(\\d?\\d)')
.replace(/l{1}/ig, '(\\d?\\d?\\d)')
.replace(/t{1,2}/ig, this._getPatternAmpm())
.replace(/z{1}/ig, '((\\+|-)\\d\\d\\d\\d)?')
.replace(/z{1}/ig, '(z|[-+]\\d\\d:?\\d\\d)?')
.replace(/\s/g, '\\s?') + this._defaults.timeSuffix + '$',
order = this._getFormatPositions(),
ampm = '',
@ -265,7 +271,29 @@ $.extend(Timepicker.prototype, {
if (order.m !== -1) this.minute = Number(treg[order.m]);
if (order.s !== -1) this.second = Number(treg[order.s]);
if (order.l !== -1) this.millisec = Number(treg[order.l]);
if (order.z !== -1) this.timezone = treg[order.z];
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;
@ -1025,6 +1053,8 @@ $.datepicker._gotoToday = function(id) {
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);