Commit c951aad8 authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix TimePeriod conditional formatting

parent 9e061431
...@@ -146,60 +146,65 @@ ...@@ -146,60 +146,65 @@
CConditionalFormattingRule.prototype.getTimePeriod = function() { CConditionalFormattingRule.prototype.getTimePeriod = function() {
var start, end; var start, end;
var now = new Date(); var now = new Date();
now.setUTCHours(0, 0, 0, 0);
switch (this.timePeriod) { switch (this.timePeriod) {
case AscCommonExcel.ST_TimePeriod.last7Days: case AscCommonExcel.ST_TimePeriod.last7Days:
now.setUTCDate(now.getUTCDate() + 1);
end = now.getExcelDate(); end = now.getExcelDate();
now.setDate(now.getDate() - 7); now.setUTCDate(now.getUTCDate() - 7);
start = now.getExcelDate(); start = now.getExcelDate();
break; break;
case AscCommonExcel.ST_TimePeriod.lastMonth: case AscCommonExcel.ST_TimePeriod.lastMonth:
now.setUTCDate(1);
end = now.getExcelDate(); end = now.getExcelDate();
now.setMonth(now.getMonth() - 1); now.setUTCMonth(now.getUTCMonth() - 1);
start = now.getExcelDate(); start = now.getExcelDate();
break; break;
case AscCommonExcel.ST_TimePeriod.thisMonth: case AscCommonExcel.ST_TimePeriod.thisMonth:
now.setUTCDate(1);
start = now.getExcelDate(); start = now.getExcelDate();
now.setMonth(now.getMonth() + 1); now.setUTCMonth(now.getUTCMonth() + 1);
end = now.getExcelDate(); end = now.getExcelDate();
break; break;
case AscCommonExcel.ST_TimePeriod.nextMonth: case AscCommonExcel.ST_TimePeriod.nextMonth:
now.setMonth(now.getMonth() + 1); now.setUTCDate(1);
now.setUTCMonth(now.getUTCMonth() + 1);
start = now.getExcelDate(); start = now.getExcelDate();
now.setMonth(now.getMonth() + 1); now.setUTCMonth(now.getUTCMonth() + 1);
end = now.getExcelDate(); end = now.getExcelDate();
break; break;
case AscCommonExcel.ST_TimePeriod.lastWeek: case AscCommonExcel.ST_TimePeriod.lastWeek:
now.setDate(now.getDate() - now.getDay()); now.setUTCDate(now.getUTCDate() - now.getUTCDay());
end = now.getExcelDate(); end = now.getExcelDate();
now.setDate(now.getDate() - 7); now.setUTCDate(now.getUTCDate() - 7);
start = now.getExcelDate(); start = now.getExcelDate();
break; break;
case AscCommonExcel.ST_TimePeriod.thisWeek: case AscCommonExcel.ST_TimePeriod.thisWeek:
now.setDate(now.getDate() - now.getDay()); now.setUTCDate(now.getUTCDate() - now.getUTCDay());
start = now.getExcelDate(); start = now.getExcelDate();
now.setDate(now.getDate() + 7); now.setUTCDate(now.getUTCDate() + 7);
end = now.getExcelDate(); end = now.getExcelDate();
break; break;
case AscCommonExcel.ST_TimePeriod.nextWeek: case AscCommonExcel.ST_TimePeriod.nextWeek:
now.setDate(now.getDate() - now.getDay() + 7); now.setUTCDate(now.getUTCDate() - now.getUTCDay() + 7);
start = now.getExcelDate(); start = now.getExcelDate();
now.setDate(now.getDate() + 7); now.setUTCDate(now.getUTCDate() + 7);
end = now.getExcelDate(); end = now.getExcelDate();
break; break;
case AscCommonExcel.ST_TimePeriod.yesterday: case AscCommonExcel.ST_TimePeriod.yesterday:
end = now.getExcelDate(); end = now.getExcelDate();
now.setDate(now.getDate() - 1); now.setUTCDate(now.getUTCDate() - 1);
start = now.getExcelDate(); start = now.getExcelDate();
break; break;
case AscCommonExcel.ST_TimePeriod.today: case AscCommonExcel.ST_TimePeriod.today:
start = now.getExcelDate(); start = now.getExcelDate();
now.setDate(now.getDate() + 1); now.setUTCDate(now.getUTCDate() + 1);
end = now.getExcelDate(); end = now.getExcelDate();
break; break;
case AscCommonExcel.ST_TimePeriod.tomorrow: case AscCommonExcel.ST_TimePeriod.tomorrow:
now.setDate(now.getDate() + 1); now.setUTCDate(now.getUTCDate() + 1);
start = now.getExcelDate(); start = now.getExcelDate();
now.setDate(now.getDate() + 1); now.setUTCDate(now.getUTCDate() + 1);
end = now.getExcelDate(); end = now.getExcelDate();
break; break;
} }
......
...@@ -2899,7 +2899,7 @@ ...@@ -2899,7 +2899,7 @@
compareFunction = (function(period) { compareFunction = (function(period) {
return function(val, c) { return function(val, c) {
var n = parseFloat(val); var n = parseFloat(val);
return period.start <= n && n <= period.end; return period.start <= n && n < period.end;
}; };
})(oRule.getTimePeriod()); })(oRule.getTimePeriod());
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment