Commit 50da75aa authored by konovalovsergey's avatar konovalovsergey

formula ca only for RAND, RANDBETWEEN, INDIRECT, NOW, TODAY, OFFSET (todo cell, info)

parent 1077fee3
...@@ -357,7 +357,6 @@ ...@@ -357,7 +357,6 @@
this.value = new cNumber(Math.round(new Date(Date.UTC(year, month - 1, day)).getExcelDate())); this.value = new cNumber(Math.round(new Date(Date.UTC(year, month - 1, day)).getExcelDate()));
} }
this.value.numFormat = 14; this.value.numFormat = 14;
this.value.ca = true;
return this.value; return this.value;
}; };
cDATE.prototype.getInfo = function () { cDATE.prototype.getInfo = function () {
...@@ -584,19 +583,19 @@ ...@@ -584,19 +583,19 @@
if (val < 60) { if (val < 60) {
return this.setCA( return this.setCA(
new cNumber(( new Date((val - AscCommonExcel.c_DateCorrectConst) * c_msPerDay) ).getUTCDate()), new cNumber(( new Date((val - AscCommonExcel.c_DateCorrectConst) * c_msPerDay) ).getUTCDate()),
true, 0); false, 0);
} else if (val == 60) { } else if (val == 60) {
return this.setCA( return this.setCA(
new cNumber(( new Date((val - AscCommonExcel.c_DateCorrectConst - 1) * c_msPerDay) ).getUTCDate() + new cNumber(( new Date((val - AscCommonExcel.c_DateCorrectConst - 1) * c_msPerDay) ).getUTCDate() +
1), true, 0); 1), false, 0);
} else { } else {
return this.setCA( return this.setCA(
new cNumber(( new Date((val - AscCommonExcel.c_DateCorrectConst - 1) * c_msPerDay) ).getUTCDate()), new cNumber(( new Date((val - AscCommonExcel.c_DateCorrectConst - 1) * c_msPerDay) ).getUTCDate()),
true, 0); false, 0);
} }
} else { } else {
return this.setCA( return this.setCA(
new cNumber(( new Date((val - AscCommonExcel.c_DateCorrectConst) * c_msPerDay) ).getUTCDate()), true, new cNumber(( new Date((val - AscCommonExcel.c_DateCorrectConst) * c_msPerDay) ).getUTCDate()), false,
0); 0);
} }
}; };
...@@ -881,7 +880,7 @@ ...@@ -881,7 +880,7 @@
} else //1 2 3 4 4 3 2 1 } else //1 2 3 4 4 3 2 1
{ {
return this.setCA(new cNumber(parseInt(( ( val - Math.floor(val) ) * 24 ).toFixed(cExcelDateTimeDigits))), return this.setCA(new cNumber(parseInt(( ( val - Math.floor(val) ) * 24 ).toFixed(cExcelDateTimeDigits))),
true, 0); false, 0);
} }
}; };
cHOUR.prototype.getInfo = function () { cHOUR.prototype.getInfo = function () {
...@@ -948,7 +947,7 @@ ...@@ -948,7 +947,7 @@
return this.setCA(new cError(cErrorType.not_numeric), true); return this.setCA(new cError(cErrorType.not_numeric), true);
} else { } else {
val = parseInt(( ( val * 24 - Math.floor(val * 24) ) * 60 ).toFixed(cExcelDateTimeDigits)) % 60; val = parseInt(( ( val * 24 - Math.floor(val * 24) ) * 60 ).toFixed(cExcelDateTimeDigits)) % 60;
return this.setCA(new cNumber(val), true, 0); return this.setCA(new cNumber(val), false, 0);
} }
}; };
cMINUTE.prototype.getInfo = function () { cMINUTE.prototype.getInfo = function () {
...@@ -1012,15 +1011,15 @@ ...@@ -1012,15 +1011,15 @@
} }
if (!AscCommon.bDate1904) { if (!AscCommon.bDate1904) {
if (val == 60) { if (val == 60) {
return this.setCA(new cNumber(2), true, 0); return this.setCA(new cNumber(2), false, 0);
} else { } else {
return this.setCA( return this.setCA(
new cNumber(( new Date(( (val == 0 ? 1 : val) - AscCommonExcel.c_DateCorrectConst - 1 ) * new cNumber(( new Date(( (val == 0 ? 1 : val) - AscCommonExcel.c_DateCorrectConst - 1 ) *
c_msPerDay) ).getUTCMonth() + 1), true, 0); c_msPerDay) ).getUTCMonth() + 1), false, 0);
} }
} else { } else {
return this.setCA(new cNumber(( new Date(( (val == 0 ? 1 : val) - AscCommonExcel.c_DateCorrectConst ) * return this.setCA(new cNumber(( new Date(( (val == 0 ? 1 : val) - AscCommonExcel.c_DateCorrectConst ) *
c_msPerDay) ).getUTCMonth() + 1), true, 0); c_msPerDay) ).getUTCMonth() + 1), false, 0);
} }
}; };
cMONTH.prototype.getInfo = function () { cMONTH.prototype.getInfo = function () {
...@@ -1253,7 +1252,7 @@ ...@@ -1253,7 +1252,7 @@
return this.setCA(new cError(cErrorType.not_numeric), true); return this.setCA(new cError(cErrorType.not_numeric), true);
} else { } else {
val = parseInt((( val * 24 * 60 - Math.floor(val * 24 * 60) ) * 60).toFixed(cExcelDateTimeDigits)) % 60; val = parseInt((( val * 24 * 60 - Math.floor(val * 24 * 60) ) * 60).toFixed(cExcelDateTimeDigits)) % 60;
return this.setCA(new cNumber(val), true, 0); return this.setCA(new cNumber(val), false, 0);
} }
}; };
cSECOND.prototype.getInfo = function () { cSECOND.prototype.getInfo = function () {
...@@ -1314,7 +1313,7 @@ ...@@ -1314,7 +1313,7 @@
second = second.getValue(); second = second.getValue();
var v = (hour * 60 * 60 + minute * 60 + second) / c_sPerDay; var v = (hour * 60 * 60 + minute * 60 + second) / c_sPerDay;
this.setCA(new cNumber(v - Math.floor(v)), true); this.setCA(new cNumber(v - Math.floor(v)), false);
if (arguments[1].getNumFormatStr().toLowerCase() === "general") { if (arguments[1].getNumFormatStr().toLowerCase() === "general") {
this.value.numFormat = 18; this.value.numFormat = 18;
} }
...@@ -1720,9 +1719,9 @@ ...@@ -1720,9 +1719,9 @@
} }
if (arguments[1].getNumFormatStr().toLowerCase() === "general") { if (arguments[1].getNumFormatStr().toLowerCase() === "general") {
return this.setCA(new cNumber(val), true, 14); return this.setCA(new cNumber(val), false, 14);
} else { } else {
return this.setCA(new cNumber(val), true); return this.setCA(new cNumber(val), false);
} }
}; };
cWORKDAY.prototype.getInfo = function () { cWORKDAY.prototype.getInfo = function () {
...@@ -1799,7 +1798,7 @@ ...@@ -1799,7 +1798,7 @@
} else { } else {
return this.setCA( return this.setCA(
new cNumber((new Date((val - (AscCommonExcel.c_DateCorrectConst + 1)) * c_msPerDay)).getUTCFullYear()), new cNumber((new Date((val - (AscCommonExcel.c_DateCorrectConst + 1)) * c_msPerDay)).getUTCFullYear()),
true, 0); false, 0);
} }
}; };
cYEAR.prototype.getInfo = function () { cYEAR.prototype.getInfo = function () {
......
...@@ -987,7 +987,7 @@ ...@@ -987,7 +987,7 @@
this.value = new cError(cErrorType.wrong_value_type); this.value = new cError(cErrorType.wrong_value_type);
} }
return this.value; return this.setCA(this.value, true);
}; };
cOFFSET.prototype.getInfo = function () { cOFFSET.prototype.getInfo = function () {
......
...@@ -2496,7 +2496,7 @@ ...@@ -2496,7 +2496,7 @@
} }
return this.setCA(quotient(arg0, arg1), true); return this.value = quotient(arg0, arg1);
}; };
cQUOTIENT.prototype.getInfo = function () { cQUOTIENT.prototype.getInfo = function () {
return { return {
......
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