Skip to content

Commit 3c7e5d5

Browse files
committed
Merge branch 'release/0.3.4' into develop
2 parents 19b861b + a904c43 commit 3c7e5d5

File tree

9 files changed

+310
-107
lines changed

9 files changed

+310
-107
lines changed

Gruntfile.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ module.exports = function (grunt) {
2121

2222
// Project configuration.
2323
grunt.initConfig({
24+
bump: {
25+
options: {
26+
files: ['package.json', 'bower.json', 'README.md', 'src/js/*.js', 'src/css/*.css'],
27+
updateConfigs: [],
28+
commit: false,
29+
createTag: false,
30+
push: false,
31+
globalReplace: false
32+
}
33+
},
2434
complexity: {
2535
generic: {
2636
src: ['src/**/*.js'],
@@ -73,4 +83,4 @@ module.exports = function (grunt) {
7383
}
7484
}
7585
});
76-
};
86+
};

README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Angular bootstrap date & time picker v0.3.3
1+
# Angular bootstrap date & time picker version: 0.3.4
22
================================
33

44
Native AngularJS datetime picker directive styled by Twitter Bootstrap 3
@@ -13,8 +13,8 @@ Native AngularJS datetime picker directive styled by Twitter Bootstrap 3
1313

1414
# Upgrading to 0.3.x
1515

16-
<code>weekStart</code> has bee removed. This directive uses the locale aware
17-
[moment.js day of week](http://momentjs.com/docs/#/get-set/weekday/) to
16+
<code>weekStart</code> has been removed. This directive uses the locale aware
17+
[moment.js day of week](http://momentjs.com/docs/#/get-set/weekday/) to
1818
determine which day is the first day of the week. If you would like a first
1919
day of week that is not standard for the locale you can create a
2020
[custom locale](http://momentjs.com/docs/#/customization/)
@@ -124,6 +124,17 @@ The following parameters are supplied by this directive :
124124
* '$upDate' the DateObject selected if the user clicks the text between the arrows.
125125
* '$rightDate' the DateObject selected if the user clicks the right arrow.
126126

127+
128+
```
129+
DateObject {
130+
dateValue: Number - UTC time value of this date object - same as moment.valueOf() or Date.getTime(). It does NOT contain time zone information so take that into account when comparing to other dates.
131+
display: String - the way this value will be displayed on the calendar.
132+
active: true | false | undefined - indicates that date object is part of the model value.
133+
selectable: true | false | undefined - indicates that date value is selectable by the user.
134+
past: true | false | undefined - indicates that date value is prior to the date range of the current view.
135+
future: true | false | undefined - indicates that date value is after the date range of the current view.
136+
}
137+
```
127138
Setting the .selectable property of a DateObject to false will prevent the user from being able to select that date value.
128139

129140
### on-set-time
@@ -177,7 +188,8 @@ The increment used to build the hour view. A button is created for each <code>mi
177188

178189
When used within a Bootstrap dropdown and jQuery, the selector specified in dropdownSelector will toggle the dropdown when a date/time is selected.
179190

180-
**NOTE:** dropdownSelector **requires** jquery and bootstrap.js. If do not have these available do not specify this option, it will cause an exception.
191+
**NOTE:** dropdownSelector **requires** jquery and bootstrap.js. If do not have these available do not specify this option. If you do, an error will
192+
be logged and this option will be removed.
181193

182194

183195
## Working with ng-model
@@ -300,4 +312,4 @@ Support this project and other work by Dale Lotts via [gittip][gittip-dalelotts]
300312
[gittip-dalelotts]: https://www.gittip.com/dalelotts/
301313

302314
[license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat
303-
[license-url]: LICENSE
315+
[license-url]: LICENSE

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-bootstrap-datetimepicker",
3-
"version": "0.3.3",
3+
"version": "0.3.4",
44
"description": "This directive allows you to add a datetime-picker to your form.",
55
"author": "https://github.com/dalelotts/angular-bootstrap-datetimepicker/graphs/contributors",
66
"license": "MIT",

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-bootstrap-datetimepicker",
3-
"version": "0.3.3",
3+
"version": "0.3.4",
44
"description": "This directive allows you to add a datetime-picker to your form elements.",
55
"author": "https://github.com/dalelotts/ng-bootstrap-datetimepicker/graphs/contributors",
66
"license": "MIT",
@@ -10,14 +10,15 @@
1010
"devDependencies": {
1111
"bower": "latest",
1212
"grunt": "^0.4.4",
13-
"grunt-complexity": "^0.1.7",
13+
"grunt-bump": "0.0.16",
14+
"grunt-complexity": "^0.2.0",
1415
"grunt-contrib-jshint": "^0.10.0",
1516
"grunt-istanbul-coverage": "^0.1.0",
1617
"grunt-karma": "^0.9.0",
1718
"karma-chrome-launcher": "^0.1.2",
1819
"karma-coverage": "^0.2.1",
1920
"karma-firefox-launcher": "^0.1.3",
20-
"karma-jasmine": "^0.1.5",
21+
"karma-jasmine": "^0.2.3",
2122
"karma-phantomjs-launcher": "^0.1.2",
2223
"matchdep": "^0.3.0",
2324
"phantomjs": "^1.9.7-1"

src/css/datetimepicker.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @license angular-bootstrap-datetimepicker v0.3.3
2+
* @license angular-bootstrap-datetimepicker version: 0.3.4
33
* (c) 2013-2014 Knight Rider Consulting, Inc. http://www.knightrider.com
44
* License: MIT
55
*/
@@ -383,4 +383,4 @@
383383
.datetimepicker thead tr:first-child th:hover,
384384
.datetimepicker tfoot tr:first-child th:hover {
385385
background: #eeeeee;
386-
}
386+
}

src/js/datetimepicker.js

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*jslint vars:true */
33

44
/**
5-
* @license angular-bootstrap-datetimepicker v0.3.3
5+
* @license angular-bootstrap-datetimepicker version: 0.3.4
66
* (c) 2013-2014 Knight Rider Consulting, Inc. http://www.knightrider.com
77
* License: MIT
88
*/
@@ -74,40 +74,50 @@ angular.module('ui.bootstrap.datetimepicker', [])
7474
if (configuration.dropdownSelector !== null && !angular.isString(configuration.dropdownSelector)) {
7575
throw ("dropdownSelector must be a string");
7676
}
77+
78+
if (configuration.dropdownSelector != null) {
79+
/* istanbul ignore next */
80+
if ((typeof jQuery === 'undefined') || (typeof jQuery().dropdown !== 'function')) {
81+
$log.error("Please DO NOT specify the dropdownSelector option unless you are using jQuery AND Bootstrap.js. " +
82+
"Please include jQuery AND Bootstrap.js, or write code to close the dropdown in the on-set-time callback. \n\n" +
83+
"The dropdownSelector configuration option is being removed because it will not function properly.");
84+
delete configuration.dropdownSelector;
85+
}
86+
}
7787
};
7888

7989
return {
8090
restrict: 'E',
8191
require: 'ngModel',
8292
template: "<div class='datetimepicker table-responsive'>" +
83-
"<table class='table table-striped'>" +
84-
" <thead>" +
85-
" <tr>" +
86-
" <th class='left' data-ng-click='changeView(data.currentView, data.leftDate, $event)' data-ng-show='data.leftDate.selectable'><i class='glyphicon glyphicon-arrow-left'/></th>" +
87-
" <th class='switch' colspan='5' data-ng-show='data.currentDate.selectable' data-ng-click='changeView(data.previousView, data.currentDate, $event)'>{{ data.currentDate.display }}</th>" +
88-
" <th class='right' data-ng-click='changeView(data.currentView, data.rightDate, $event)' data-ng-show='data.rightDate.selectable'><i class='glyphicon glyphicon-arrow-right'/></th>" +
89-
" </tr>" +
90-
" <tr>" +
91-
" <th class='dow' data-ng-repeat='day in data.dayNames' >{{ day }}</th>" +
92-
" </tr>" +
93-
" </thead>" +
94-
" <tbody>" +
95-
" <tr data-ng-if='data.currentView !== \"day\"' >" +
96-
" <td colspan='7' >" +
97-
" <span class='{{ data.currentView }}' " +
98-
" data-ng-repeat='dateObject in data.dates' " +
99-
" data-ng-class='{active: dateObject.active, past: dateObject.past, future: dateObject.future, disabled: !dateObject.selectable}' " +
100-
" data-ng-click=\"changeView(data.nextView, dateObject, $event)\">{{ dateObject.display }}</span> " +
101-
" </td>" +
102-
" </tr>" +
103-
" <tr data-ng-if='data.currentView === \"day\"' data-ng-repeat='week in data.weeks'>" +
104-
" <td data-ng-repeat='dateObject in week.dates' " +
105-
" data-ng-click='changeView(data.nextView, dateObject, $event)'" +
106-
" class='day' " +
107-
" data-ng-class='{active: dateObject.active, past: dateObject.past, future: dateObject.future, disabled: !dateObject.selectable}' >{{ dateObject.display }}</td>" +
108-
" </tr>" +
109-
" </tbody>" +
110-
"</table></div>",
93+
"<table class='table table-striped'>" +
94+
" <thead>" +
95+
" <tr>" +
96+
" <th class='left' data-ng-click='changeView(data.currentView, data.leftDate, $event)' data-ng-show='data.leftDate.selectable'><i class='glyphicon glyphicon-arrow-left'/></th>" +
97+
" <th class='switch' colspan='5' data-ng-show='data.currentDate.selectable' data-ng-click='changeView(data.previousView, data.currentDate, $event)'>{{ data.currentDate.display }}</th>" +
98+
" <th class='right' data-ng-click='changeView(data.currentView, data.rightDate, $event)' data-ng-show='data.rightDate.selectable'><i class='glyphicon glyphicon-arrow-right'/></th>" +
99+
" </tr>" +
100+
" <tr>" +
101+
" <th class='dow' data-ng-repeat='day in data.dayNames' >{{ day }}</th>" +
102+
" </tr>" +
103+
" </thead>" +
104+
" <tbody>" +
105+
" <tr data-ng-if='data.currentView !== \"day\"' >" +
106+
" <td colspan='7' >" +
107+
" <span class='{{ data.currentView }}' " +
108+
" data-ng-repeat='dateObject in data.dates' " +
109+
" data-ng-class='{active: dateObject.active, past: dateObject.past, future: dateObject.future, disabled: !dateObject.selectable}' " +
110+
" data-ng-click=\"changeView(data.nextView, dateObject, $event)\">{{ dateObject.display }}</span> " +
111+
" </td>" +
112+
" </tr>" +
113+
" <tr data-ng-if='data.currentView === \"day\"' data-ng-repeat='week in data.weeks'>" +
114+
" <td data-ng-repeat='dateObject in week.dates' " +
115+
" data-ng-click='changeView(data.nextView, dateObject, $event)'" +
116+
" class='day' " +
117+
" data-ng-class='{active: dateObject.active, past: dateObject.past, future: dateObject.future, disabled: !dateObject.selectable}' >{{ dateObject.display }}</td>" +
118+
" </tr>" +
119+
" </tbody>" +
120+
"</table></div>",
111121
scope: {
112122
ngModel: "=",
113123
onSetTime: "&",
@@ -220,7 +230,7 @@ angular.module('ui.bootstrap.datetimepicker', [])
220230
}
221231

222232
for (var i = 0; i < 6; i++) {
223-
var week = { dates: [] };
233+
var week = {dates: []};
224234
for (var j = 0; j < 7; j++) {
225235
var monthMoment = moment.utc(startDate).add((i * 7) + j, 'days');
226236
var dateValue = {
@@ -306,17 +316,10 @@ angular.module('ui.bootstrap.datetimepicker', [])
306316
scope.ngModel = newDate;
307317

308318
if (configuration.dropdownSelector) {
309-
310-
/* istanbul ignore else */
311-
if (typeof jQuery !== 'undefined') {
312-
jQuery(configuration.dropdownSelector).dropdown('toggle');
313-
} else {
314-
$log.error("Please DO NOT specify the dropdownSelector option unless you are using jQuery. " +
315-
"Please include jQuery or write code to close the dropdown in the on-set-time callback. ");
316-
}
319+
jQuery(configuration.dropdownSelector).dropdown('toggle');
317320
}
318321

319-
scope.onSetTime({ newDate: scope.ngModel, oldDate: oldDate });
322+
scope.onSetTime({newDate: scope.ngModel, oldDate: oldDate});
320323

321324
return dataFactory[configuration.startView](unixDate);
322325
}
@@ -351,19 +354,19 @@ angular.module('ui.bootstrap.datetimepicker', [])
351354
$view: result.currentView,
352355
$dates: result.dates || weekDates,
353356
$leftDate: result.leftDate,
354-
$upDate: result.currenDate,
357+
$upDate: result.currentDate,
355358
$rightDate: result.rightDate
356359
});
357360

358361
scope.data = result;
359362
}
360363
};
361364

362-
scope.changeView(configuration.startView, new DateObject({ dateValue: getUTCTime(), selectable: true }));
365+
scope.changeView(configuration.startView, new DateObject({dateValue: getUTCTime(), selectable: true}));
363366

364367
scope.$watch('ngModel', function () {
365-
scope.changeView(scope.data.currentView, new DateObject({ dateValue: getUTCTime() }));
368+
scope.changeView(scope.data.currentView, new DateObject({dateValue: getUTCTime()}));
366369
});
367370
}
368371
};
369-
}]);
372+
}]);

test/configuration/beforeRender.js

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)