Now select the current month if exists.
This commit is contained in:
@ -285,15 +285,23 @@ var ListViewModel = function() {
|
||||
|
||||
var monthToSelect = null;
|
||||
|
||||
// Reset selected month to the new instance corresponding to the old one
|
||||
if(self.month()) {
|
||||
// Find the new instance of the previously selected month.
|
||||
$.each(self.months(), function(index, month) {
|
||||
var today = new Date();
|
||||
var currentYear = today.getFullYear().toString();
|
||||
var currentMonth = (today.getMonth() + 1 < 10 ? "0" : "") + (today.getMonth() + 1);
|
||||
|
||||
// Find the new instance of the previously selected month.
|
||||
$.each(self.months(), function(index, month) {
|
||||
// Reset selected month to the new instance corresponding to the old one
|
||||
if(self.month()) {
|
||||
if(month.year() === self.month().year() && month.month() === self.month().month()) {
|
||||
monthToSelect = month;
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if(month.year() === currentYear && month.month() === currentMonth) {
|
||||
monthToSelect = month;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Set selected month to the last one if not yet selected.
|
||||
if(!monthToSelect && self.months().length > 0) {
|
||||
|
Reference in New Issue
Block a user