mirror of
https://github.com/HackPlan/angular-datepicker.git
synced 2026-01-12 22:44:06 +08:00
Fixed january breaking with previous patch due to date being shifted back 5 days
Fixes the situation where date.getMonth() turns into 11, thus breaking the patch.
This commit is contained in:
@@ -23,7 +23,7 @@ function getVisibleMinutes(date, step) {
|
||||
|
||||
function getVisibleWeeks(date) {
|
||||
date = new Date(date || new Date());
|
||||
var startMonth = date.getMonth();
|
||||
var startMonth = date.getMonth(), startYear = date.getYear();
|
||||
date.setDate(1);
|
||||
date.setHours(0);
|
||||
date.setMinutes(0);
|
||||
@@ -41,7 +41,7 @@ function getVisibleWeeks(date) {
|
||||
|
||||
var weeks = [];
|
||||
while (weeks.length < 6) {
|
||||
if(date.getMonth() > startMonth) break;
|
||||
if(date.getYear()== startYear && date.getMonth() > startMonth) break;
|
||||
var week = [];
|
||||
for (var i = 0; i < 7; i++) {
|
||||
week.push(new Date(date));
|
||||
|
||||
Reference in New Issue
Block a user