Skip to content
This repository was archived by the owner on Feb 14, 2019. It is now read-only.

Commit 10cc56b

Browse files
Merge remote-tracking branch 'upstream/master' into bug/prevent-bad-characters
* upstream/master: Version bump Version bump Fixed onRender method according to PR #571 Version bump Fix exception thrown after clearing value using built in clear button Ensure we are supporting all browsers for timezone abbreviation * browsers on a different OS will return a different format Update bootstrap-datetimepicker.css
2 parents 66ee0f1 + 0175948 commit 10cc56b

File tree

6 files changed

+31
-11
lines changed

6 files changed

+31
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ This event is fired when a day is rendered inside the datepicker. Should return
323323
$('#date-end')
324324
.datetimepicker({
325325
onRender: function(date) {
326-
return ev.date.valueOf() < date-start-display.valueOf() ? ' disabled' : '';
326+
return date.valueOf() < date-start-display.valueOf() ? ' disabled' : '';
327327
}
328328
});
329329
```

css/bootstrap-datetimepicker.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a));
193193
background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a);
194194
background-image: -o-linear-gradient(top, #fdd49a, #fdf59a);
195-
background-image: linear-gradient(top, #fdd49a, #fdf59a);
195+
background-image: linear-gradient(to bottom, #fdd49a, #fdf59a);
196196
background-repeat: repeat-x;
197197
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0);
198198
border-color: #fdf59a #fdf59a #fbed50;
@@ -244,7 +244,7 @@
244244
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
245245
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
246246
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
247-
background-image: linear-gradient(top, #0088cc, #0044cc);
247+
background-image: linear-gradient(to bottom, #0088cc, #0044cc);
248248
background-repeat: repeat-x;
249249
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
250250
border-color: #0044cc #0044cc #002a80;
@@ -343,7 +343,7 @@
343343
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
344344
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
345345
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
346-
background-image: linear-gradient(top, #0088cc, #0044cc);
346+
background-image: linear-gradient(to bottom, #0088cc, #0044cc);
347347
background-repeat: repeat-x;
348348
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
349349
border-color: #0044cc #0044cc #002a80;

css/bootstrap-datetimepicker.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/bootstrap-datetimepicker.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,24 @@
6363
return isFixed;
6464
}
6565

66+
// Add timezone abbreviation support for ie6+, Chrome, Firefox
67+
function timeZoneAbbreviation() {
68+
var abbreviation, date, formattedStr, i, len, matchedStrings, ref, str;
69+
date = (new Date).toString();
70+
formattedStr = ((ref = date.split('(')[1]) != null ? ref.slice(0, -1) : void 0) || date.split(' ');
71+
if (formattedStr instanceof Array) {
72+
matchedStrings = [];
73+
for (i = 0, len = formattedStr.length; i < len; i++) {
74+
str = formattedStr[i];
75+
if (abbreviation = (ref = str.match(/\b[A-Z]+\b/)) != null ? ref[0] : void 0) {
76+
matchedStrings.push(abbreviation);
77+
}
78+
}
79+
formattedStr = matchedStrings.pop();
80+
}
81+
return formattedStr;
82+
};
83+
6684
function UTCDate() {
6785
return new Date(Date.UTC.apply(Date, arguments));
6886
}
@@ -109,8 +127,7 @@
109127
this.initialDate = options.initialDate || new Date();
110128
this.zIndex = options.zIndex || this.element.data('z-index') || undefined;
111129
this.title = typeof options.title === 'undefined' ? false : options.title;
112-
this.defaultTimeZone = (new Date).toString().split('(')[1].slice(0, -1);
113-
this.timezone = options.timezone || this.defaultTimeZone;
130+
this.timezone = options.timezone || timeZoneAbbreviation();
114131

115132
this.icons = {
116133
leftArrow: this.fontAwesome ? 'fa-arrow-left' : (this.bootcssVer === 3 ? 'glyphicon-arrow-left' : 'icon-arrow-left'),
@@ -253,6 +270,7 @@
253270

254271
this.weekStart = ((options.weekStart || this.element.data('date-weekstart') || dates[this.language].weekStart || 0) % 7);
255272
this.weekEnd = ((this.weekStart + 6) % 7);
273+
this.onRender = options.onRender || function () { return ''; };
256274
this.startDate = -Infinity;
257275
this.endDate = Infinity;
258276
this.datesDisabled = [];
@@ -388,6 +406,9 @@
388406

389407
getDate: function () {
390408
var d = this.getUTCDate();
409+
if (d === null) {
410+
return null;
411+
}
391412
return new Date(d.getTime() + (d.getTimezoneOffset() * 60000));
392413
},
393414

@@ -677,12 +698,11 @@
677698
nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
678699
nextMonth = nextMonth.valueOf();
679700
var html = [];
680-
var clsName;
701+
var clsName = this.onRender(prevMonth)
681702
while (prevMonth.valueOf() < nextMonth) {
682703
if (prevMonth.getUTCDay() == this.weekStart) {
683704
html.push('<tr>');
684705
}
685-
clsName = '';
686706
if (prevMonth.getUTCFullYear() < year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() < month)) {
687707
clsName += ' old';
688708
} else if (prevMonth.getUTCFullYear() > year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() > month)) {

js/bootstrap-datetimepicker.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "bootstrap-datetime-picker",
33
"homepage": "http://www.malot.fr/bootstrap-datetimepicker/",
44
"description": "Both Date and Time picker widget based on twitter bootstrap",
5-
"version": "2.3.11",
5+
"version": "2.3.14",
66
"license": "Apache 2.0",
77
"author": {
88
"name": "Sebastien Malot"

0 commit comments

Comments
 (0)