Index: frontends/php/include/views/js/reports.toptriggers.js.php =================================================================== --- frontends/php/include/views/js/reports.toptriggers.js.php (revision 51942) +++ frontends/php/include/views/js/reports.toptriggers.js.php (working copy) @@ -10,13 +10,17 @@ switch (period) { case : + var dateTill = new Date(date.getFullYear(), date.getMonth(), + date.getDate() + 1 + ); + newPeriod = { 'fromYear': date.getFullYear(), 'fromMonth': date.getMonth() + 1, 'fromDay': date.getDate(), - 'tillYear': date.getFullYear(), - 'tillMonth': date.getMonth() + 1, - 'tillDay': date.getDate() + 1 + 'tillYear': dateTill.getFullYear(), + 'tillMonth': dateTill.getMonth() + 1, + 'tillDay': dateTill.getDate() } break; @@ -50,12 +54,16 @@ break; case : + var dateTill = new Date(date.getFullYear(), date.getMonth() + 1, + 1 + ); + newPeriod = { 'fromYear': date.getFullYear(), 'fromMonth': date.getMonth() + 1, 'fromDay': '1', - 'tillYear': date.getFullYear(), - 'tillMonth': date.getMonth() + 2, + 'tillYear': dateTill.getFullYear(), + 'tillMonth': dateTill.getMonth() + 1, 'tillDay': '1' } break; @@ -88,22 +96,16 @@ break; case : - if (date.getMonth() == 0) { - // 11 month is december - date = new Date(date.getFullYear() - 1, 11, 31); - } - else { - date = new Date(date.getFullYear(), date.getMonth() - 1, - daysInMonth(date.getFullYear(), date.getMonth() - 1) - ); - } + var dateFrom = new Date(date.getFullYear(), date.getMonth() - 1, + 1 + ); newPeriod = { - 'fromYear': date.getFullYear(), - 'fromMonth': date.getMonth() + 1, + 'fromYear': dateFrom.getFullYear(), + 'fromMonth': dateFrom.getMonth() + 1, 'fromDay': '1', 'tillYear': date.getFullYear(), - 'tillMonth': date.getMonth() + 2, + 'tillMonth': date.getMonth() + 1, 'tillDay': '1' } break; @@ -120,13 +122,17 @@ break; default: + var dateTill = new Date(date.getFullYear(), date.getMonth(), + date.getDate() + 1 + ); + newPeriod = { 'fromYear': date.getFullYear(), 'fromMonth': date.getMonth() + 1, 'fromDay': date.getDate(), - 'tillYear': date.getFullYear(), - 'tillMonth': date.getMonth() + 1, - 'tillDay': date.getDate() + 1 + 'tillYear': dateTill.getFullYear(), + 'tillMonth': dateTill.getMonth() + 1, + 'tillDay': dateTill.getDate() } }