diff options
-rw-r--r-- | index.html | 12 | ||||
-rw-r--r-- | jquery-ui-timepicker-addon.js | 12 |
2 files changed, 15 insertions, 9 deletions
@@ -21,7 +21,7 @@ .example-container{ background-color: #f4f4f4; border-bottom: solid 2px #777777; margin: 0 0 40px 0; padding: 20px; } .example-container p{ font-weight: bold; } .example-container > dl dt{ font-weight: bold; height: 20px; } - .example-container > dl dd{ margin: -20px 0 10px 100px; border-bottom: solid 1px #fff; } + .example-container > dl dd{ margin: -20px 0 10px 140px; border-bottom: solid 1px #fff; } .example-container input{ width: 150px; } .clear{ clear: both; } #ui-datepicker-div, .ui-datepicker{ font-size: 80%; } @@ -164,6 +164,7 @@ $('#example4').datetimepicker({ <dt>showMinute</dt><dd>Show the minute, default=true</dd> <dt>showSecond</dt><dd>Show the second, default=false</dd> <dt>showMillisec</dt><dd>Show the millisecond, default=false</dd> + <dt>showTimezone</dt><dd>Show the timezone, default=false</dd> </dl> <div> <input type="text" name="example5" id="example5" value="" /> @@ -427,12 +428,15 @@ $('#example14').datetimepicker({ <!-- ============= example --> <div class="example-container"> - <p>Use the utility function to format your own time. $.datepicker.formatTime(format, time, options)</p> + <p>The following demonstrates how to use timezones and timezone options.</p> <dl> <dt>timezoneList</dt><dd>An array of timezones, either with strings ['-0500','-0600',..] or objects [ { value: '-0500', label: 'EST'}, { value: '-0600', label: 'CST' },..]</dd> - <dt>timezoneIso8601</dt><dd>Formats the timezones in the timezone list in 8601 format + <dt>defaultTimezone</dt><dd>The default selected timezone in the dropdown. default='+0000'</dd> + <dt>useLocalTimezone</dt><dd>Use the local timezone of the client's browser. default=false</dd> + <dt>timezoneIso8601</dt><dd>Formats the timezones in the timezone list in 8601 format</dd> </dl> - + <p>The third example here demonstrates using the abbreviation for timezones. If this is used defaultTimezone must match the value (abbreviation). Do note that useLocalTimezone may not function properly when using abbreviations as it will only work with '+0000' formats.</p> + <p>Daylight savings time may be interpreted as a timezone. Create your own timezoneList and specify entries for Daylight Savings or use useLocalTimezone to help get the correct offset.</p> <div> <input type="text" name="example15a" id="example15a" value="" /> <input type="text" name="example15b" id="example15b" value="" /> diff --git a/jquery-ui-timepicker-addon.js b/jquery-ui-timepicker-addon.js index 09b056b..f5c4a33 100644 --- a/jquery-ui-timepicker-addon.js +++ b/jquery-ui-timepicker-addon.js @@ -182,10 +182,12 @@ $.extend(Timepicker.prototype, { 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'); - } + 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']; + // 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.timezoneIso8601) { timezoneList = $.map(timezoneList, function(val) { return val == '+0000' ? 'Z' : (val.substring(0, 3) + ':' + val.substring(3)); @@ -307,7 +309,7 @@ $.extend(Timepicker.prototype, { millisecGridSize = 0, size = null; - // Hours + // Hours html += '<dd class="ui_tpicker_hour"><div class="ui_tpicker_hour_slider"' + ((o.showHour) ? '' : noDisplay) + '></div>'; if (o.showHour && o.hourGrid > 0) { |