Skip to content

Commit 2675998

Browse files
Merge branch 'dev'
2 parents bef7fab + 4ef6892 commit 2675998

File tree

4 files changed

+77
-47
lines changed

4 files changed

+77
-47
lines changed

component.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery-timepicker-addon",
3-
"version": "1.3",
3+
"version": "1.3.1",
44
"repository": {
55
"type": "git",
66
"url": "git://github.com/trentrichardson/jQuery-Timepicker-Addon.git"

i18n/jquery-ui-timepicker-sv.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
(function($) {
44
$.timepicker.regional['sv'] = {
55
timeOnlyTitle: 'Välj en tid',
6-
timeText: 'Timme',
7-
hourText: 'Timmar',
8-
minuteText: 'Minuter',
9-
secondText: 'Sekunder',
10-
millisecText: 'Millisekunder',
11-
microsecText: 'Mikrosekunder',
6+
timeText: 'Tid',
7+
hourText: 'Timme',
8+
minuteText: 'Minut',
9+
secondText: 'Sekund',
10+
millisecText: 'Millisekund',
11+
microsecText: 'Mikrosekund',
1212
timezoneText: 'Tidszon',
1313
currentText: 'Nu',
1414
closeText: 'Stäng',

index.html

+23-18
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,6 @@
4141
<link rel="stylesheet" media="all" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
4242
<link rel="stylesheet" media="all" type="text/css" href="jquery-ui-timepicker-addon.css" />
4343

44-
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
45-
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
46-
<script type="text/javascript" src="jquery-ui-timepicker-addon.js"></script>
47-
<script type="text/javascript" src="jquery-ui-sliderAccess.js"></script>
48-
<script type="text/javascript">
49-
50-
$(function(){
51-
$('#tabs').tabs();
52-
53-
$('.example-container > pre').each(function(i){
54-
eval($(this).text());
55-
});
56-
});
57-
58-
</script>
5944
</head>
6045
<body>
6146
<div class="wrapper">
@@ -140,9 +125,9 @@ <h3>Requirements</h3>
140125

141126
<br />
142127
<h3>Version</h3>
143-
<p>Version 1.3</p>
128+
<p>Version 1.3.1</p>
144129

145-
<p>Last updated on 05/05/2013</p>
130+
<p>Last updated on 07/07/2013</p>
146131
<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>
147132
<p><a href="http://trentrichardson.com/Impromptu/GPL-LICENSE.txt" title="GPL License">GPL License</a></p>
148133
<p><a href="http://trentrichardson.com/Impromptu/MIT-LICENSE.txt" title="MIT License">MIT License</a></p>
@@ -844,6 +829,7 @@ <h3 id="rest_examples">Time Restraints</h3>
844829
var endDateTextBox = $('#rest_example_4_end');
845830

846831
startDateTextBox.datetimepicker({
832+
timeFormat: 'HH:mm z',
847833
onClose: function(dateText, inst) {
848834
if (endDateTextBox.val() != '') {
849835
var testStartDate = startDateTextBox.datetimepicker('getDate');
@@ -860,6 +846,7 @@ <h3 id="rest_examples">Time Restraints</h3>
860846
}
861847
});
862848
endDateTextBox.datetimepicker({
849+
timeFormat: 'HH:mm z',
863850
onClose: function(dateText, inst) {
864851
if (startDateTextBox.val() != '') {
865852
var testStartDate = startDateTextBox.datetimepicker('getDate');
@@ -954,9 +941,27 @@ <h3 id="utility_examples">Utilities</h3>
954941

955942
</div>
956943

944+
945+
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
946+
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
947+
<script type="text/javascript" src="jquery-ui-timepicker-addon.js"></script>
948+
<script type="text/javascript" src="jquery-ui-sliderAccess.js"></script>
949+
950+
<script type="text/javascript">
951+
952+
$(function(){
953+
$('#tabs').tabs();
954+
955+
$('.example-container > pre').each(function(i){
956+
eval($(this).text());
957+
});
958+
});
959+
960+
</script>
961+
957962
<script type="text/javascript" src="https://sellfy.com/js/api_buttons.js"></script>
958963
<script type="text/javascript" src="https://gumroad.com/js/gumroad.js"></script>
959-
964+
960965
<script type="text/javascript"> /*
961966
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
962967
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

jquery-ui-timepicker-addon.js

+47-22
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* jQuery timepicker addon
33
* By: Trent Richardson [http://trentrichardson.com]
4-
* Version 1.3
5-
* Last Modified: 05/05/2013
4+
* Version 1.3.1
5+
* Last Modified: 07/07/2013
66
*
77
* Copyright 2013 Trent Richardson
88
* You may use this project under MIT or GPL licenses.
@@ -27,7 +27,7 @@
2727
*/
2828
$.extend($.ui, {
2929
timepicker: {
30-
version: "1.3"
30+
version: "1.3.1"
3131
}
3232
});
3333

@@ -163,7 +163,7 @@
163163
/*
164164
* Create a new Timepicker instance
165165
*/
166-
_newInst: function($input, o) {
166+
_newInst: function($input, opts) {
167167
var tp_inst = new Timepicker(),
168168
inlineSettings = {},
169169
fns = {},
@@ -206,11 +206,11 @@
206206
};
207207
for (i in overrides) {
208208
if (overrides.hasOwnProperty(i)) {
209-
fns[i] = o[i] || null;
209+
fns[i] = opts[i] || null;
210210
}
211211
}
212212

213-
tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, overrides, {
213+
tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, opts, overrides, {
214214
evnts:fns,
215215
timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
216216
});
@@ -270,8 +270,8 @@
270270
tp_inst.ampm = '';
271271
tp_inst.$input = $input;
272272

273-
if (o.altField) {
274-
tp_inst.$altInput = $(o.altField).css({
273+
if (tp_inst._defaults.altField) {
274+
tp_inst.$altInput = $(tp_inst._defaults.altField).css({
275275
cursor: 'pointer'
276276
}).focus(function() {
277277
$input.trigger("focus");
@@ -543,6 +543,7 @@
543543
}
544544
// end slideAccess integration
545545

546+
tp_inst._limitMinMaxDateTime(this.inst, true);
546547
}
547548
},
548549

@@ -824,7 +825,8 @@
824825
*/
825826
_updateDateTime: function(dp_inst) {
826827
dp_inst = this.inst || dp_inst;
827-
var dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
828+
//var dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
829+
var dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay)),
828830
dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
829831
formatCfg = $.datepicker._getFormatConfig(dp_inst),
830832
timeAvailable = dt !== null && this.timeDefined;
@@ -1076,7 +1078,7 @@
10761078
if (parseRes.timeObj) {
10771079
var t = parseRes.timeObj;
10781080
parseRes.date.setHours(t.hour, t.minute, t.second, t.millisec);
1079-
parseRex.date.setMicroseconds(t.microsec);
1081+
parseRes.date.setMicroseconds(t.microsec);
10801082
}
10811083

10821084
return parseRes.date;
@@ -1546,6 +1548,7 @@
15461548
tp_date.setMicroseconds(tp_inst.microsec);
15471549
} else {
15481550
tp_date = new Date(date.getTime());
1551+
tp_date.setMicroseconds(date.getMicroseconds());
15491552
}
15501553
if (tp_date.toString() == 'Invalid Date') {
15511554
tp_date = undefined;
@@ -1566,14 +1569,31 @@
15661569
return;
15671570
}
15681571

1569-
var tp_inst = this._get(inst, 'timepicker'),
1570-
tp_date = (date instanceof Date) ? new Date(date.getTime()) : date;
1572+
if(typeof(date) === 'string'){
1573+
date = new Date(date);
1574+
if(!date.getTime()){
1575+
$.timepicker.log("Error creating Date object from string.");
1576+
}
1577+
}
1578+
1579+
var tp_inst = this._get(inst, 'timepicker');
1580+
var tp_date;
1581+
if (date instanceof Date) {
1582+
tp_date = new Date(date.getTime());
1583+
tp_date.setMicroseconds(date.getMicroseconds());
1584+
} else {
1585+
tp_date = date;
1586+
}
15711587

15721588
// This is important if you are using the timezone option, javascript's Date
15731589
// object will only return the timezone offset for the current locale, so we
15741590
// adjust it accordingly. If not using timezone option this won't matter..
15751591
// If a timezone is different in tp, keep the timezone as is
1576-
if(tp_inst && tp_inst.timezone != null){
1592+
if(tp_inst){
1593+
// look out for DST if tz wasn't specified
1594+
if(!tp_inst.support.timezone && tp_inst._defaults.timezone === null){
1595+
tp_inst.timezone = tp_date.getTimezoneOffset()*-1;
1596+
}
15771597
date = $.timepicker.timezoneAdjust(date, tp_inst.timezone);
15781598
tp_date = $.timepicker.timezoneAdjust(tp_date, tp_inst.timezone);
15791599
}
@@ -1610,6 +1630,10 @@
16101630
// object will only return the timezone offset for the current locale, so we
16111631
// adjust it accordingly. If not using timezone option this won't matter..
16121632
if(tp_inst.timezone != null){
1633+
// look out for DST if tz wasn't specified
1634+
if(!tp_inst.support.timezone && tp_inst._defaults.timezone === null){
1635+
tp_inst.timezone = date.getTimezoneOffset()*-1;
1636+
}
16131637
date = $.timepicker.timezoneAdjust(date, tp_inst.timezone);
16141638
}
16151639
}
@@ -1780,7 +1804,7 @@
17801804
millisec: isIn(tf,'l'),
17811805
microsec: isIn(tf,'c'),
17821806
timezone: isIn(tf,'z'),
1783-
ampm: isIn('t') && isIn(timeFormat,'h'),
1807+
ampm: isIn(tf,'t') && isIn(timeFormat,'h'),
17841808
iso8601: isIn(timeFormat, 'Z')
17851809
};
17861810
};
@@ -1944,10 +1968,7 @@
19441968
$.timepicker.timezoneAdjust = function(date, toTimezone) {
19451969
var toTz = $.timepicker.timezoneOffsetNumber(toTimezone);
19461970
if(!isNaN(toTz)){
1947-
var currTz = date.getTimezoneOffset()*-1,
1948-
diff = currTz - toTz; // difference in minutes
1949-
1950-
date.setMinutes(date.getMinutes()+diff);
1971+
date.setMinutes(date.getMinutes()*1 + (date.getTimezoneOffset()*-1 - toTz*1) );
19511972
}
19521973
return date;
19531974
};
@@ -2087,17 +2108,21 @@
20872108
};
20882109

20892110
/*
2090-
* Rough microsecond support
2111+
* Microsecond support
20912112
*/
20922113
if(!Date.prototype.getMicroseconds){
2093-
Date.microseconds = 0;
2114+
Date.prototype.microseconds = 0;
20942115
Date.prototype.getMicroseconds = function(){ return this.microseconds; };
2095-
Date.prototype.setMicroseconds = function(m){ this.microseconds = m; return this; };
2116+
Date.prototype.setMicroseconds = function(m){
2117+
this.setMilliseconds(this.getMilliseconds() + Math.floor(m/1000));
2118+
this.microseconds = m%1000;
2119+
return this;
2120+
};
20962121
}
20972122

20982123
/*
20992124
* Keep up with the version
21002125
*/
2101-
$.timepicker.version = "1.3";
2126+
$.timepicker.version = "1.3.1";
21022127

21032128
})(jQuery);

0 commit comments

Comments
 (0)