mirror of
https://github.com/frappe/air-datepicker.git
synced 2026-01-14 11:01:22 +08:00
fixed current date detection method
This commit is contained in:
parent
f8b762c481
commit
a364079130
15
dist/js/datepicker.js
vendored
15
dist/js/datepicker.js
vendored
@ -47,7 +47,7 @@ var Datepicker;
|
||||
|
||||
this.currentDate = this.opts.start;
|
||||
this.currentView = this.opts.defaultView;
|
||||
this.selectedDate = '';
|
||||
this.selectedDate = [];
|
||||
this.views = {};
|
||||
|
||||
this.init()
|
||||
@ -110,7 +110,6 @@ var Datepicker;
|
||||
this.date = new Date(d.year + 10, 0, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
prev: function () {
|
||||
@ -409,11 +408,15 @@ Datepicker.Cell = function () {
|
||||
},
|
||||
|
||||
_getDayHtml: function (date) {
|
||||
var _class = "datepicker--cell datepicker--cell-day";
|
||||
var _class = "datepicker--cell datepicker--cell-day",
|
||||
currentDate = new Date(),
|
||||
d = Datepicker.getParsedDate(date);
|
||||
|
||||
if (this.d.isWeekend(date.getDay())) _class += " -weekend-";
|
||||
if (date.getMonth() != this.d.currentDate.getMonth()) _class += " -another-month-";
|
||||
if (date.getDate() == new Date().getDate()) _class += ' -current-';
|
||||
if (this.d.isWeekend(d.day)) _class += " -weekend-";
|
||||
if (d.month != this.d.parsedDate.month) _class += " -another-month-";
|
||||
if (d.date == currentDate.getDate() &&
|
||||
d.month == currentDate.getMonth() &&
|
||||
d.year == currentDate.getFullYear()) _class += ' -current-';
|
||||
|
||||
return '<div class="' + _class + '" data-date="' + date.getDate() + '">' + date.getDate() + '</div>';
|
||||
},
|
||||
|
||||
@ -85,11 +85,15 @@
|
||||
},
|
||||
|
||||
_getDayHtml: function (date) {
|
||||
var _class = "datepicker--cell datepicker--cell-day";
|
||||
var _class = "datepicker--cell datepicker--cell-day",
|
||||
currentDate = new Date(),
|
||||
d = Datepicker.getParsedDate(date);
|
||||
|
||||
if (this.d.isWeekend(date.getDay())) _class += " -weekend-";
|
||||
if (date.getMonth() != this.d.currentDate.getMonth()) _class += " -another-month-";
|
||||
if (date.getDate() == new Date().getDate()) _class += ' -current-';
|
||||
if (this.d.isWeekend(d.day)) _class += " -weekend-";
|
||||
if (d.month != this.d.parsedDate.month) _class += " -another-month-";
|
||||
if (d.date == currentDate.getDate() &&
|
||||
d.month == currentDate.getMonth() &&
|
||||
d.year == currentDate.getFullYear()) _class += ' -current-';
|
||||
|
||||
return '<div class="' + _class + '" data-date="' + date.getDate() + '">' + date.getDate() + '</div>';
|
||||
},
|
||||
|
||||
@ -47,7 +47,7 @@ var Datepicker;
|
||||
|
||||
this.currentDate = this.opts.start;
|
||||
this.currentView = this.opts.defaultView;
|
||||
this.selectedDate = '';
|
||||
this.selectedDate = [];
|
||||
this.views = {};
|
||||
|
||||
this.init()
|
||||
@ -110,7 +110,6 @@ var Datepicker;
|
||||
this.date = new Date(d.year + 10, 0, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
prev: function () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user