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

fix bug 32666 (ignore flag date-start-1904)

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