19
19
pre { padding : 20px ; background-color : # ffffcc ; border : solid 1px # fff ; }
20
20
.wrapper { background-color : # ffffff ; width : 800px ; border : solid 1px # eeeeee ; padding : 20px ; margin : 0 auto; }
21
21
.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 { }
23
23
.example-container > dl dt { font-weight : bold; height : 20px ; }
24
- .example-container > dl dd { margin : -20px 0 10px 100 px ; border-bottom : solid 1px # fff ; }
24
+ .example-container > dl dd { margin : -20px 0 10px 140 px ; border-bottom : solid 1px # fff ; }
25
25
.example-container input { width : 150px ; }
26
26
.clear { clear : both; }
27
27
# ui-datepicker-div , .ui-datepicker { font-size : 80% ; }
30
30
< link rel ="stylesheet " media ="all " type ="text/css " href ="http://code.jquery.com/ui/1.8.21/themes/ui-lightness/jquery-ui.css " />
31
31
< link rel ="stylesheet " media ="all " type ="text/css " href ="jquery-ui-timepicker-addon.css " />
32
32
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 >
35
35
< script type ="text/javascript " src ="jquery-ui-timepicker-addon.js "> </ script >
36
36
< script type ="text/javascript " src ="jquery-ui-sliderAccess.js "> </ script >
37
37
< script type ="text/javascript ">
@@ -72,6 +72,8 @@ <h2>Download</h2>
72
72
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
73
73
</ pre >
74
74
75
+ < p > You also need to include jQuery UI with datepicker and slider wigits. Order: jQuery, jQueryUI, Timepicker.</ p >
76
+
75
77
< h2 > Donation</ h2 >
76
78
< p > Has this Timepicker Addon been helpful to you?</ p >
77
79
< div class ="donation ">
@@ -139,6 +141,7 @@ <h2>Some Examples</h2>
139
141
< dt > T</ dt > < dd > A or P for AM/PM</ dd >
140
142
< dt > tt</ dt > < dd > am or pm for AM/PM</ dd >
141
143
< 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 >
142
145
</ dl >
143
146
< p > Also related to your timeFormat, but not required, is the separator option</ p >
144
147
< dl >
@@ -164,6 +167,7 @@ <h2>Some Examples</h2>
164
167
< dt > showMinute</ dt > < dd > Show the minute, default=true</ dd >
165
168
< dt > showSecond</ dt > < dd > Show the second, default=false</ dd >
166
169
< dt > showMillisec</ dt > < dd > Show the millisecond, default=false</ dd >
170
+ < dt > showTimezone</ dt > < dd > Show the timezone, default=false</ dd >
167
171
</ dl >
168
172
< div >
169
173
< input type ="text " name ="example5 " id ="example5 " value ="" />
@@ -314,18 +318,24 @@ <h2>Some Examples</h2>
314
318
};
315
319
$.datepicker.setDefaults($.datepicker.regional['ru']);
316
320
321
+
317
322
$.timepicker.regional['ru'] = {
318
323
timeOnlyTitle: 'Выберите время',
319
324
timeText: 'Время',
320
325
hourText: 'Часы',
321
326
minuteText: 'Минуты',
322
327
secondText: 'Секунды',
323
- millisecText: 'миллисекунды',
324
- currentText: 'Теперь',
328
+ millisecText: 'Миллисекунды',
329
+ timezoneText: 'Часовой пояс',
330
+ currentText: 'Сейчас',
325
331
closeText: 'Закрыть',
332
+ timeFormat: 'hh:mm tt',
333
+ amNames: ['AM', 'A'],
334
+ pmNames: ['PM', 'P'],
326
335
ampm: false
327
336
};
328
337
$.timepicker.setDefaults($.timepicker.regional['ru']);
338
+
329
339
</ pre >
330
340
331
341
</ div >
@@ -423,16 +433,65 @@ <h2>Some Examples</h2>
423
433
});
424
434
</ pre >
425
435
</ 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 >
426
454
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
+
427
486
<!-- ============= example -->
428
487
< div class ="example-container ">
429
488
< p > Connect to the onSelect event (Use your browser's js console for this example).</ p >
430
489
< div >
431
- < input type ="text " name ="example15 " id ="example15 " value ="" />
490
+ < input type ="text " name ="example16 " id ="example16 " value ="" />
432
491
</ div >
433
492
434
493
< pre >
435
- $('#example15 ').datetimepicker({
494
+ $('#example16 ').datetimepicker({
436
495
showSecond: true,
437
496
showMillisec: true,
438
497
timeFormat: 'hh:mm:ss:l',
@@ -448,45 +507,44 @@ <h2>Some Examples</h2>
448
507
< div class ="example-container ">
449
508
< p > Create a datetime range with a start and end date.</ p >
450
509
< 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 ="" />
452
511
</ div >
453
512
454
513
< 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
+ }
472
532
});
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
+ }
490
548
});
491
549
</ pre >
492
550
</ div >
@@ -495,11 +553,11 @@ <h2>Some Examples</h2>
495
553
< div class ="example-container ">
496
554
< 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 >
497
555
< div >
498
- < div id ="example17 "> </ div >
556
+ < div id ="example18 "> </ div >
499
557
</ div >
500
558
501
559
< pre >
502
- $('#example17 ').datetimepicker({
560
+ $('#example18 ').datetimepicker({
503
561
addSliderAccess: true,
504
562
sliderAccessArgs: { touchonly: false }
505
563
});
@@ -517,20 +575,22 @@ <h2>Some Examples</h2>
517
575
</ dl >
518
576
519
577
< div >
520
- < div id ="example18 "> </ div >
578
+ < div id ="example19 "> </ div >
521
579
</ div >
522
580
523
581
< pre >
524
- $('#example18 ').text(
582
+ $('#example19 ').text(
525
583
$.datepicker.formatTime('hh:mm z', { hour: 14, minute: 36, timezone: '+2000' }, { ampm: false })
526
584
);
527
585
</ pre >
528
586
</ div >
587
+
588
+
529
589
530
590
< h2 > Version</ h2 >
531
- < p > Version 1.0.1 </ p >
591
+ < p > Version 1.0.2 </ p >
532
592
533
- < p > Last updated on 07/01 /2012</ p >
593
+ < p > Last updated on 09/8 /2012</ p >
534
594
< 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 >
535
595
< p > < a href ="http://trentrichardson.com/Impromptu/GPL-LICENSE.txt " title ="GPL License "> GPL License</ a > </ p >
536
596
< p > < a href ="http://trentrichardson.com/Impromptu/MIT-LICENSE.txt " title ="MIT License "> MIT License</ a > </ p >
0 commit comments