Skip to content

Commit 7297789

Browse files
committed
Merge branch 'develop'
2 parents 93b32d4 + ebdb36f commit 7297789

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "UI widget for datetime range input, converted to an angular directive for your convenience.",
55
"homepage": "https://github.com/g1eb/angular-datetime-range",
66
"authors": [
7-
7+
"g1eb <[email protected]> (https://g1eb.com)"
88
],
99
"license": "MIT",
1010
"main": [

dist/datetime-range.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
@@ -3,7 +3,7 @@
33
"version": "0.2.12",
44
"description": "UI widget for datetime range input, converted to an angular directive for your convenience.",
55
"homepage": "https://github.com/g1eb/angular-datetime-range#readme",
6-
"author": "Gleb <[email protected]>",
6+
"author": "g1eb <[email protected]> (https://g1eb.com)",
77
"license": "MIT",
88
"main": "index.js",
99
"repository": {

src/datetime-range.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,15 @@ angular.module('g1b.datetime-range', []).
3737
// Get number of weeks in month
3838
scope.getNumWeeks = function () {
3939
if ( !scope.calendar ) { return; }
40-
return Math.floor(scope.calendar.clone().endOf('month').endOf('week').diff(scope.calendar.clone().startOf('month').startOf('week'), 'days') / 7) + 1;
40+
41+
var firstDayOfWeek = scope.calendar.clone().startOf('week').weekday();
42+
43+
var firstOfMonth = scope.calendar.clone().startOf('month');
44+
var lastOfMonth = scope.calendar.clone().endOf('month');
45+
46+
var firstWeekDay = (firstOfMonth.weekday() - firstDayOfWeek + 7) % 7;
47+
48+
return Math.ceil((firstWeekDay + scope.calendar.daysInMonth()) / 7);
4149
}
4250

4351
// Set selected date

0 commit comments

Comments
 (0)