Skip to content

Commit 0abd583

Browse files
Merge branch 'dev'
2 parents 7b9ba9a + 54547fb commit 0abd583

5 files changed

+370
-113
lines changed

index.html

+109-49
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
pre{ padding: 20px; background-color: #ffffcc; border: solid 1px #fff; }
2020
.wrapper{ background-color: #ffffff; width: 800px; border: solid 1px #eeeeee; padding: 20px; margin: 0 auto; }
2121
.example-container{ background-color: #f4f4f4; border-bottom: solid 2px #777777; margin: 0 0 40px 0; padding: 20px; }
22-
.example-container p{ font-weight: bold; }
22+
.example-container p{ }
2323
.example-container > dl dt{ font-weight: bold; height: 20px; }
24-
.example-container > dl dd{ margin: -20px 0 10px 100px; border-bottom: solid 1px #fff; }
24+
.example-container > dl dd{ margin: -20px 0 10px 140px; border-bottom: solid 1px #fff; }
2525
.example-container input{ width: 150px; }
2626
.clear{ clear: both; }
2727
#ui-datepicker-div, .ui-datepicker{ font-size: 80%; }
@@ -30,8 +30,8 @@
3030
<link rel="stylesheet" media="all" type="text/css" href="http://code.jquery.com/ui/1.8.21/themes/ui-lightness/jquery-ui.css" />
3131
<link rel="stylesheet" media="all" type="text/css" href="jquery-ui-timepicker-addon.css" />
3232

33-
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
34-
<script type="text/javascript" src="http://code.jquery.com/ui/1.8.21/jquery-ui.min.js"></script>
33+
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
34+
<script type="text/javascript" src="http://code.jquery.com/ui/1.8.23/jquery-ui.min.js"></script>
3535
<script type="text/javascript" src="jquery-ui-timepicker-addon.js"></script>
3636
<script type="text/javascript" src="jquery-ui-sliderAccess.js"></script>
3737
<script type="text/javascript">
@@ -72,6 +72,8 @@ <h2>Download</h2>
7272
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
7373
</pre>
7474

75+
<p>You also need to include jQuery UI with datepicker and slider wigits. Order: jQuery, jQueryUI, Timepicker.</p>
76+
7577
<h2>Donation</h2>
7678
<p>Has this Timepicker Addon been helpful to you?</p>
7779
<div class="donation">
@@ -139,6 +141,7 @@ <h2>Some Examples</h2>
139141
<dt>T</dt><dd>A or P for AM/PM</dd>
140142
<dt>tt</dt><dd>am or pm for AM/PM</dd>
141143
<dt>TT</dt><dd>AM or PM for AM/PM</dd>
144+
<dt>z</dt><dd>Timezone (as defined by <a href="#example15a" title="timezoneList">timezoneList</a>)</dd>
142145
</dl>
143146
<p>Also related to your timeFormat, but not required, is the separator option</p>
144147
<dl>
@@ -164,6 +167,7 @@ <h2>Some Examples</h2>
164167
<dt>showMinute</dt><dd>Show the minute, default=true</dd>
165168
<dt>showSecond</dt><dd>Show the second, default=false</dd>
166169
<dt>showMillisec</dt><dd>Show the millisecond, default=false</dd>
170+
<dt>showTimezone</dt><dd>Show the timezone, default=false</dd>
167171
</dl>
168172
<div>
169173
<input type="text" name="example5" id="example5" value="" />
@@ -314,18 +318,24 @@ <h2>Some Examples</h2>
314318
};
315319
$.datepicker.setDefaults($.datepicker.regional['ru']);
316320

321+
317322
$.timepicker.regional['ru'] = {
318323
timeOnlyTitle: 'Выберите время',
319324
timeText: 'Время',
320325
hourText: 'Часы',
321326
minuteText: 'Минуты',
322327
secondText: 'Секунды',
323-
millisecText: 'миллисекунды',
324-
currentText: 'Теперь',
328+
millisecText: 'Миллисекунды',
329+
timezoneText: 'Часовой пояс',
330+
currentText: 'Сейчас',
325331
closeText: 'Закрыть',
332+
timeFormat: 'hh:mm tt',
333+
amNames: ['AM', 'A'],
334+
pmNames: ['PM', 'P'],
326335
ampm: false
327336
};
328337
$.timepicker.setDefaults($.timepicker.regional['ru']);
338+
329339
</pre>
330340

331341
</div>
@@ -423,16 +433,65 @@ <h2>Some Examples</h2>
423433
});
424434
</pre>
425435
</div>
436+
437+
438+
<!-- ============= example -->
439+
<div class="example-container">
440+
<p>The following demonstrates how to use timezones and timezone options.</p>
441+
<dl>
442+
<dt>timezoneList</dt><dd>An array of timezones, either with strings ['-0500','-0600',..] or objects [ { value: '-0500', label: 'EST'}, { value: '-0600', label: 'CST' },..]</dd>
443+
<dt>defaultTimezone</dt><dd>The default selected timezone in the dropdown. default='+0000'</dd>
444+
<dt>useLocalTimezone</dt><dd>Use the local timezone of the client's browser. default=false</dd>
445+
<dt>timezoneIso8601</dt><dd>Formats the timezones in the timezone list in 8601 format</dd>
446+
</dl>
447+
<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>
448+
<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>
449+
<div>
450+
<input type="text" name="example15a" id="example15a" value="" />
451+
<input type="text" name="example15b" id="example15b" value="" />
452+
<input type="text" name="example15c" id="example15c" value="" />
453+
</div>
426454

455+
<pre>
456+
$('#example15a').datetimepicker({
457+
timeFormat: 'hh:mm z',
458+
showTimezone: true
459+
});
460+
461+
$('#example15b').datetimepicker({
462+
timeFormat: 'hh:mm z',
463+
showTimezone: true,
464+
timezoneList: [
465+
{ value: '-0500', label: 'Eastern'},
466+
{ value: '-0600', label: 'Central' },
467+
{ value: '-0700', label: 'Mountain' },
468+
{ value: '-0800', label: 'Pacific' }
469+
]
470+
});
471+
472+
$('#example15c').datetimepicker({
473+
timeFormat: 'hh:mm z',
474+
showTimezone: true,
475+
timezone: 'MT',
476+
timezoneList: [
477+
{ value: 'ET', label: 'Eastern'},
478+
{ value: 'CT', label: 'Central' },
479+
{ value: 'MT', label: 'Mountain' },
480+
{ value: 'PT', label: 'Pacific' }
481+
]
482+
});
483+
</pre>
484+
</div>
485+
427486
<!-- ============= example -->
428487
<div class="example-container">
429488
<p>Connect to the onSelect event (Use your browser's js console for this example).</p>
430489
<div>
431-
<input type="text" name="example15" id="example15" value="" />
490+
<input type="text" name="example16" id="example16" value="" />
432491
</div>
433492

434493
<pre>
435-
$('#example15').datetimepicker({
494+
$('#example16').datetimepicker({
436495
showSecond: true,
437496
showMillisec: true,
438497
timeFormat: 'hh:mm:ss:l',
@@ -448,45 +507,44 @@ <h2>Some Examples</h2>
448507
<div class="example-container">
449508
<p>Create a datetime range with a start and end date.</p>
450509
<div>
451-
<input type="text" name="example16_start" id="example16_start" value="" /> <input type="text" name="example16_end" id="example16_end" value="" />
510+
<input type="text" name="example17_start" id="example17_start" value="" /> <input type="text" name="example17_end" id="example17_end" value="" />
452511
</div>
453512

454513
<pre>
455-
$('#example16_start').datetimepicker({
456-
onClose: function(dateText, inst) {
457-
var endDateTextBox = $('#example16_end');
458-
if (endDateTextBox.val() != '') {
459-
var testStartDate = new Date(dateText);
460-
var testEndDate = new Date(endDateTextBox.val());
461-
if (testStartDate > testEndDate)
462-
endDateTextBox.val(dateText);
463-
}
464-
else {
465-
endDateTextBox.val(dateText);
466-
}
467-
},
468-
onSelect: function (selectedDateTime){
469-
var start = $(this).datetimepicker('getDate');
470-
$('#example16_end').datetimepicker('option', 'minDate', new Date(start.getTime()));
471-
}
514+
var startDateTextBox = $('#example17_start');
515+
var endDateTextBox = $('#example17_end');
516+
517+
startDateTextBox.datetimepicker({
518+
onClose: function(dateText, inst) {
519+
if (endDateTextBox.val() != '') {
520+
var testStartDate = startDateTextBox.datetimepicker('getDate');
521+
var testEndDate = endDateTextBox.datetimepicker('getDate');
522+
if (testStartDate > testEndDate)
523+
endDateTextBox.datetimepicker('setDate', testStartDate);
524+
}
525+
else {
526+
endDateTextBox.val(dateText);
527+
}
528+
},
529+
onSelect: function (selectedDateTime){
530+
endDateTextBox.datetimepicker('option', 'minDate', startDateTextBox.datetimepicker('getDate') );
531+
}
472532
});
473-
$('#example16_end').datetimepicker({
474-
onClose: function(dateText, inst) {
475-
var startDateTextBox = $('#example16_start');
476-
if (startDateTextBox.val() != '') {
477-
var testStartDate = new Date(startDateTextBox.val());
478-
var testEndDate = new Date(dateText);
479-
if (testStartDate > testEndDate)
480-
startDateTextBox.val(dateText);
481-
}
482-
else {
483-
startDateTextBox.val(dateText);
484-
}
485-
},
486-
onSelect: function (selectedDateTime){
487-
var end = $(this).datetimepicker('getDate');
488-
$('#example16_start').datetimepicker('option', 'maxDate', new Date(end.getTime()) );
489-
}
533+
endDateTextBox.datetimepicker({
534+
onClose: function(dateText, inst) {
535+
if (startDateTextBox.val() != '') {
536+
var testStartDate = startDateTextBox.datetimepicker('getDate');
537+
var testEndDate = endDateTextBox.datetimepicker('getDate');
538+
if (testStartDate > testEndDate)
539+
startDateTextBox.datetimepicker('setDate', testEndDate);
540+
}
541+
else {
542+
startDateTextBox.val(dateText);
543+
}
544+
},
545+
onSelect: function (selectedDateTime){
546+
startDateTextBox.datetimepicker('option', 'maxDate', endDateTextBox.datetimepicker('getDate') );
547+
}
490548
});
491549
</pre>
492550
</div>
@@ -495,11 +553,11 @@ <h2>Some Examples</h2>
495553
<div class="example-container">
496554
<p>Use the <a href="http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/" title="jQueryUI Slider Accessibility Addon">sliderAccess addon</a> to allow timepicker sliders to work on touch devices.</p>
497555
<div>
498-
<div id="example17"></div>
556+
<div id="example18"></div>
499557
</div>
500558

501559
<pre>
502-
$('#example17').datetimepicker({
560+
$('#example18').datetimepicker({
503561
addSliderAccess: true,
504562
sliderAccessArgs: { touchonly: false }
505563
});
@@ -517,20 +575,22 @@ <h2>Some Examples</h2>
517575
</dl>
518576

519577
<div>
520-
<div id="example18"></div>
578+
<div id="example19"></div>
521579
</div>
522580

523581
<pre>
524-
$('#example18').text(
582+
$('#example19').text(
525583
$.datepicker.formatTime('hh:mm z', { hour: 14, minute: 36, timezone: '+2000' }, { ampm: false })
526584
);
527585
</pre>
528586
</div>
587+
588+
529589

530590
<h2>Version</h2>
531-
<p>Version 1.0.1</p>
591+
<p>Version 1.0.2</p>
532592

533-
<p>Last updated on 07/01/2012</p>
593+
<p>Last updated on 09/8/2012</p>
534594
<p>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. </p>
535595
<p><a href="http://trentrichardson.com/Impromptu/GPL-LICENSE.txt" title="GPL License">GPL License</a></p>
536596
<p><a href="http://trentrichardson.com/Impromptu/MIT-LICENSE.txt" title="MIT License">MIT License</a></p>

0 commit comments

Comments
 (0)