Commit 1931ed9e authored by Alexander Trofimov's avatar Alexander Trofimov Committed by GitHub

Merge pull request #18 from ONLYOFFICE/release/3.8.1

fix bug 32666 (ignore flag date-start-1904)
parents 1af02a5d b38d0c3c
......@@ -383,7 +383,6 @@ $( function () {
var c_msPerDay = AscCommonExcel.c_msPerDay;
var parserFormula = AscCommonExcel.parserFormula;
var GetDiffDate360 = AscCommonExcel.GetDiffDate360;
var bDate1904 = AscCommon.bDate1904;
var fSortAscending = AscCommon.fSortAscending;
var g_oIdCounter = AscCommon.g_oIdCounter;
......@@ -391,7 +390,6 @@ $( function () {
data = getTestWorkbook(),
sData = data + "", tmp;
if ( AscCommon.c_oSerFormat.Signature === sData.substring( 0, AscCommon.c_oSerFormat.Signature.length ) ) {
var sUrlPath = "offlinedocs/";
wb = new AscCommonExcel.Workbook( new AscCommonExcel.asc_CHandlersList(), {wb:{getWorksheet:function(){}}} );
AscCommon.History.init(wb);
......@@ -702,7 +700,7 @@ $( function () {
test( "Test: YEAR", function () {
oParser = new parserFormula( "YEAR(2013)", "A1", ws );
ok( oParser.parse() );
if ( bDate1904 )
if ( AscCommon.bDate1904 )
strictEqual( oParser.calculate().getValue(), 1909 );
else
strictEqual( oParser.calculate().getValue(), 1905 );
......@@ -711,7 +709,7 @@ $( function () {
test( "Test: DAY", function () {
oParser = new parserFormula( "DAY(2013)", "A1", ws );
ok( oParser.parse() );
if ( bDate1904 )
if ( AscCommon.bDate1904 )
strictEqual( oParser.calculate().getValue(), 6 );
else
strictEqual( oParser.calculate().getValue(), 5 );
......@@ -1022,7 +1020,7 @@ $( function () {
oParser = new parserFormula( "VALUE(\"03-26-2006\")", "A2", ws );
ok( oParser.parse() );
if ( bDate1904 )
if ( AscCommon.bDate1904 )
strictEqual( oParser.calculate().getValue(), 37340 );
else
strictEqual( oParser.calculate().getValue(), 38802 );
......@@ -1064,7 +1062,7 @@ $( function () {
oParser = new parserFormula( "DATEVALUE(\"03-26-2006\")", "A2", ws );
ok( oParser.parse() );
if ( bDate1904 )
if ( AscCommon.bDate1904 )
strictEqual( oParser.calculate().getValue(), 37340 );
else
strictEqual( oParser.calculate().getValue(), 38802 );
......@@ -1072,7 +1070,7 @@ $( function () {
test( "Test: \"EDATE\"", function () {
if ( !bDate1904 ) {
if ( !AscCommon.bDate1904 ) {
oParser = new parserFormula( "EDATE(DATE(2006,1,31),5)", "A2", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), 38898 );
......@@ -1112,7 +1110,7 @@ $( function () {
test( "Test: \"EOMONTH\"", function () {
if ( !bDate1904 ) {
if ( !AscCommon.bDate1904 ) {
oParser = new parserFormula( "EOMONTH(DATE(2006,1,31),5)", "A2", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), 38898 );
......
......@@ -55,7 +55,6 @@ var cExcelMaxExponent = 308;
var cExcelMinExponent = -308;
var c_Date1904Const = 24107; //разница в днях между 01.01.1970 и 01.01.1904 годами
var c_Date1900Const = 25568; //разница в днях между 01.01.1970 и 01.01.1900 годами
var c_DateCorrectConst = c_Date1900Const;
var c_sPerDay = 86400;
var c_msPerDay = c_sPerDay * 1000;
var rx_sFuncPref = /_xlfn\./i;
......@@ -92,7 +91,7 @@ Date.prototype.getExcelDate = function () {
};
Date.prototype.getExcelDateWithTime = function () {
// return Math.floor( ( this.getTime() / 1000 - this.getTimezoneOffset() * 60 ) / c_sPerDay + ( c_DateCorrectConst + (bDate1904 ? 0 : 1) ) );
// return Math.floor( ( this.getTime() / 1000 - this.getTimezoneOffset() * 60 ) / c_sPerDay + ( AscCommonExcel.c_DateCorrectConst + (bDate1904 ? 0 : 1) ) );
var year = this.getUTCFullYear(), month = this.getUTCMonth(), date = this.getUTCDate(), res;
if (1900 < year || (1900 == year && 1 < month)) {
......@@ -5104,7 +5103,7 @@ function rtl_math_erfc( x ) {
window['AscCommonExcel'].cExcelMinExponent = cExcelMinExponent;
window['AscCommonExcel'].c_Date1904Const = c_Date1904Const;
window['AscCommonExcel'].c_Date1900Const = c_Date1900Const;
window['AscCommonExcel'].c_DateCorrectConst = c_DateCorrectConst;
window['AscCommonExcel'].c_DateCorrectConst = c_Date1900Const;
window['AscCommonExcel'].c_sPerDay = c_sPerDay;
window['AscCommonExcel'].c_msPerDay = c_msPerDay;
......
......@@ -6,7 +6,6 @@
*/
function(window, undefined) {
// Import
var bDate1904 = AscCommon.bDate1904;
var CellValueType = AscCommon.CellValueType;
var c_oAscNumFormatType = Asc.c_oAscNumFormatType;
......@@ -1047,7 +1046,7 @@ NumFormat.prototype =
ttimes[i-1].val++;
}
var stDate, day, month, year, dayWeek;
if(bDate1904)
if(AscCommon.bDate1904)
{
stDate = new Date(Date.UTC(1904,0,1,0,0,0));
if(d.val)
......@@ -1377,7 +1376,7 @@ NumFormat.prototype =
},
isInvalidDateValue : function(number)
{
return (number == number - 0) && ((number < 0 && false == bDate1904) || number > 2958465.9999884);
return (number == number - 0) && ((number < 0 && !AscCommon.bDate1904) || number > 2958465.9999884);
},
format: function (number, nValType, dDigitsCount, oAdditionalResult, cultureInfo, bChart)
{
......@@ -3415,7 +3414,7 @@ FormatParser.prototype =
var nDay;
var nMounth;
var nYear;
if(bDate1904)
if(AscCommon.bDate1904)
{
nDay = 1;
nMounth = 0;
......@@ -3483,7 +3482,7 @@ FormatParser.prototype =
}
if(true == bValidDate && (true == bDate || true == bTime))
{
if(bDate1904)
if(AscCommon.bDate1904)
dValue = (Date.UTC(nYear,nMounth,nDay,nHour,nMinute,nSecond) - Date.UTC(1904,0,1,0,0,0)) / (86400 * 1000);
else
{
......
......@@ -6,7 +6,6 @@
*/
function(window, undefined) {
var g_cCharDelimiter = String.fromCharCode(5);
var bDate1904 = false;
var FONT_THUMBNAIL_HEIGHT = (7 * 96.0 / 25.4) >> 0;
var c_oAscMaxColumnWidth = 255;
var c_oAscMaxRowHeight = 409;
......@@ -1370,7 +1369,7 @@ window['Asc']['c_oAscMaxCellOrCommentLength'] = window['Asc'].c_oAscMaxCellOrCom
window['AscCommon'] = window['AscCommon'] || {};
window["AscCommon"].g_cCharDelimiter = g_cCharDelimiter;
window["AscCommon"].bDate1904 = bDate1904;
window["AscCommon"].bDate1904 = false;
window["AscCommon"].c_oAscAdvancedOptionsAction = c_oAscAdvancedOptionsAction;
window["AscCommon"].DownloadType = DownloadType;
window["AscCommon"].CellValueType = CellValueType;
......
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