Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
b38d0c3c
Commit
b38d0c3c
authored
Jun 16, 2016
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug 32666 (ignore flag date-start-1904)
parent
d567edb9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
68 deletions
+61
-68
cell/.unit-tests/FormulaTests.js
cell/.unit-tests/FormulaTests.js
+6
-8
cell/model/FormulaObjects/dateandtimeFunctions.js
cell/model/FormulaObjects/dateandtimeFunctions.js
+48
-50
cell/model/FormulaObjects/parserFormula.js
cell/model/FormulaObjects/parserFormula.js
+2
-3
common/NumFormat.js
common/NumFormat.js
+4
-5
common/commonDefines.js
common/commonDefines.js
+1
-2
No files found.
cell/.unit-tests/FormulaTests.js
View file @
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
);
...
...
cell/model/FormulaObjects/dateandtimeFunctions.js
View file @
b38d0c3c
...
...
@@ -5,12 +5,10 @@
* @param {undefined} undefined
*/
function
(
window
,
undefined
)
{
var
bDate1904
=
AscCommon
.
bDate1904
;
var
g_oFormatParser
=
AscCommon
.
g_oFormatParser
;
var
cElementType
=
AscCommonExcel
.
cElementType
;
var
cErrorType
=
AscCommonExcel
.
cErrorType
;
var
c_DateCorrectConst
=
AscCommonExcel
.
c_DateCorrectConst
;
var
c_sPerDay
=
AscCommonExcel
.
c_sPerDay
;
var
c_msPerDay
=
AscCommonExcel
.
c_msPerDay
;
var
cNumber
=
AscCommonExcel
.
cNumber
;
...
...
@@ -581,7 +579,7 @@ cDAY.prototype.Calculate = function ( arg ) {
return
this
.
setCA
(
new
cError
(
cErrorType
.
wrong_value_type
),
true
);
}
else
val
=
Math
.
floor
(
(
d
.
getTime
()
/
1000
-
d
.
getTimezoneOffset
()
*
60
)
/
c_sPerDay
+
(
c_DateCorrectConst
+
(
bDate1904
?
0
:
1
)
)
);
val
=
Math
.
floor
(
(
d
.
getTime
()
/
1000
-
d
.
getTimezoneOffset
()
*
60
)
/
c_sPerDay
+
(
AscCommonExcel
.
c_DateCorrectConst
+
(
AscCommon
.
bDate1904
?
0
:
1
)
)
);
}
else
{
val
=
arg0
.
tocNumber
().
getValue
();
...
...
@@ -589,16 +587,16 @@ cDAY.prototype.Calculate = function ( arg ) {
}
if
(
val
<
0
)
return
this
.
setCA
(
new
cError
(
cErrorType
.
not_numeric
),
true
);
else
if
(
!
bDate1904
)
{
else
if
(
!
AscCommon
.
bDate1904
)
{
if
(
val
<
60
)
return
this
.
setCA
(
new
cNumber
(
(
new
Date
(
(
val
-
c_DateCorrectConst
)
*
c_msPerDay
)
).
getUTCDate
()
),
true
,
0
);
return
this
.
setCA
(
new
cNumber
(
(
new
Date
(
(
val
-
AscCommonExcel
.
c_DateCorrectConst
)
*
c_msPerDay
)
).
getUTCDate
()
),
true
,
0
);
else
if
(
val
==
60
)
return
this
.
setCA
(
new
cNumber
(
(
new
Date
(
(
val
-
c_DateCorrectConst
-
1
)
*
c_msPerDay
)
).
getUTCDate
()
+
1
),
true
,
0
);
return
this
.
setCA
(
new
cNumber
(
(
new
Date
(
(
val
-
AscCommonExcel
.
c_DateCorrectConst
-
1
)
*
c_msPerDay
)
).
getUTCDate
()
+
1
),
true
,
0
);
else
return
this
.
setCA
(
new
cNumber
(
(
new
Date
(
(
val
-
c_DateCorrectConst
-
1
)
*
c_msPerDay
)
).
getUTCDate
()
),
true
,
0
);
return
this
.
setCA
(
new
cNumber
(
(
new
Date
(
(
val
-
AscCommonExcel
.
c_DateCorrectConst
-
1
)
*
c_msPerDay
)
).
getUTCDate
()
),
true
,
0
);
}
else
return
this
.
setCA
(
new
cNumber
(
(
new
Date
(
(
val
-
c_DateCorrectConst
)
*
c_msPerDay
)
).
getUTCDate
()
),
true
,
0
);
return
this
.
setCA
(
new
cNumber
(
(
new
Date
(
(
val
-
AscCommonExcel
.
c_DateCorrectConst
)
*
c_msPerDay
)
).
getUTCDate
()
),
true
,
0
);
};
cDAY
.
prototype
.
getInfo
=
function
()
{
return
{
...
...
@@ -719,16 +717,16 @@ cEDATE.prototype.Calculate = function ( arg ) {
if
(
val
<
0
)
return
this
.
setCA
(
new
cError
(
cErrorType
.
not_numeric
),
true
);
else
if
(
!
bDate1904
)
{
else
if
(
!
AscCommon
.
bDate1904
)
{
if
(
val
<
60
)
val
=
new
Date
(
(
val
-
c_DateCorrectConst
)
*
c_msPerDay
);
val
=
new
Date
(
(
val
-
AscCommonExcel
.
c_DateCorrectConst
)
*
c_msPerDay
);
else
if
(
val
==
60
)
val
=
new
Date
(
(
val
-
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
val
=
new
Date
(
(
val
-
AscCommonExcel
.
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
else
val
=
new
Date
(
(
val
-
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
val
=
new
Date
(
(
val
-
AscCommonExcel
.
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
}
else
val
=
new
Date
(
(
val
-
c_DateCorrectConst
)
*
c_msPerDay
);
val
=
new
Date
(
(
val
-
AscCommonExcel
.
c_DateCorrectConst
)
*
c_msPerDay
);
date
=
new
Date
(
val
);
...
...
@@ -744,7 +742,7 @@ cEDATE.prototype.Calculate = function ( arg ) {
val
=
new
Date
(
val
.
setUTCMonth
(
val
.
getUTCMonth
()
+
arg1
.
getValue
()
)
);
}
return
this
.
value
=
new
cNumber
(
Math
.
floor
(
(
val
.
getTime
()
/
1000
-
val
.
getTimezoneOffset
()
*
60
)
/
c_sPerDay
+
(
c_DateCorrectConst
+
1
)
)
)
return
this
.
value
=
new
cNumber
(
Math
.
floor
(
(
val
.
getTime
()
/
1000
-
val
.
getTimezoneOffset
()
*
60
)
/
c_sPerDay
+
(
AscCommonExcel
.
c_DateCorrectConst
+
1
)
)
)
};
cEDATE
.
prototype
.
getInfo
=
function
()
{
return
{
...
...
@@ -799,22 +797,22 @@ cEOMONTH.prototype.Calculate = function ( arg ) {
if
(
val
<
0
)
return
this
.
setCA
(
new
cError
(
cErrorType
.
not_numeric
),
true
);
else
if
(
!
bDate1904
)
{
else
if
(
!
AscCommon
.
bDate1904
)
{
if
(
val
<
60
)
val
=
new
Date
(
(
val
-
c_DateCorrectConst
)
*
c_msPerDay
);
val
=
new
Date
(
(
val
-
AscCommonExcel
.
c_DateCorrectConst
)
*
c_msPerDay
);
else
if
(
val
==
60
)
val
=
new
Date
(
(
val
-
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
val
=
new
Date
(
(
val
-
AscCommonExcel
.
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
else
val
=
new
Date
(
(
val
-
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
val
=
new
Date
(
(
val
-
AscCommonExcel
.
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
}
else
val
=
new
Date
(
(
val
-
c_DateCorrectConst
)
*
c_msPerDay
);
val
=
new
Date
(
(
val
-
AscCommonExcel
.
c_DateCorrectConst
)
*
c_msPerDay
);
val
.
setUTCDate
(
1
);
val
.
setUTCMonth
(
val
.
getUTCMonth
()
+
arg1
.
getValue
()
);
val
.
setUTCDate
(
val
.
getDaysInMonth
()
);
return
this
.
value
=
new
cNumber
(
Math
.
floor
(
(
val
.
getTime
()
/
1000
-
val
.
getTimezoneOffset
()
*
60
)
/
c_sPerDay
+
(
c_DateCorrectConst
+
1
)
)
);
return
this
.
value
=
new
cNumber
(
Math
.
floor
(
(
val
.
getTime
()
/
1000
-
val
.
getTimezoneOffset
()
*
60
)
/
c_sPerDay
+
(
AscCommonExcel
.
c_DateCorrectConst
+
1
)
)
);
};
cEOMONTH
.
prototype
.
getInfo
=
function
()
{
return
{
...
...
@@ -877,7 +875,7 @@ cHOUR.prototype.Calculate = function ( arg ) {
val
=
d
.
value
;
}
else
val
=
(
d
.
getTime
()
/
1000
-
d
.
getTimezoneOffset
()
*
60
)
/
c_sPerDay
+
(
c_DateCorrectConst
+
(
bDate1904
?
0
:
1
)
);
val
=
(
d
.
getTime
()
/
1000
-
d
.
getTimezoneOffset
()
*
60
)
/
c_sPerDay
+
(
AscCommonExcel
.
c_DateCorrectConst
+
(
AscCommon
.
bDate1904
?
0
:
1
)
);
}
else
{
val
=
arg0
.
tocNumber
().
getValue
();
...
...
@@ -949,7 +947,7 @@ cMINUTE.prototype.Calculate = function ( arg ) {
val
=
d
.
value
;
}
else
val
=
(
d
.
getTime
()
/
1000
-
d
.
getTimezoneOffset
()
*
60
)
/
c_sPerDay
+
(
c_DateCorrectConst
+
(
bDate1904
?
0
:
1
)
);
val
=
(
d
.
getTime
()
/
1000
-
d
.
getTimezoneOffset
()
*
60
)
/
c_sPerDay
+
(
AscCommonExcel
.
c_DateCorrectConst
+
(
AscCommon
.
bDate1904
?
0
:
1
)
);
}
else
{
val
=
arg0
.
tocNumber
().
getValue
();
...
...
@@ -1019,7 +1017,7 @@ cMONTH.prototype.Calculate = function ( arg ) {
return
this
.
setCA
(
new
cError
(
cErrorType
.
wrong_value_type
),
true
);
}
else
val
=
Math
.
floor
(
(
d
.
getTime
()
/
1000
-
d
.
getTimezoneOffset
()
*
60
)
/
c_sPerDay
+
(
c_DateCorrectConst
+
(
bDate1904
?
0
:
1
)
)
);
val
=
Math
.
floor
(
(
d
.
getTime
()
/
1000
-
d
.
getTimezoneOffset
()
*
60
)
/
c_sPerDay
+
(
AscCommonExcel
.
c_DateCorrectConst
+
(
AscCommon
.
bDate1904
?
0
:
1
)
)
);
}
else
{
val
=
arg0
.
tocNumber
().
getValue
();
...
...
@@ -1027,14 +1025,14 @@ cMONTH.prototype.Calculate = function ( arg ) {
}
if
(
val
<
0
)
return
this
.
setCA
(
new
cError
(
cErrorType
.
not_numeric
),
true
);
if
(
!
bDate1904
)
{
if
(
!
AscCommon
.
bDate1904
)
{
if
(
val
==
60
)
return
this
.
setCA
(
new
cNumber
(
2
),
true
,
0
);
else
return
this
.
setCA
(
new
cNumber
(
(
new
Date
(
(
(
val
==
0
?
1
:
val
)
-
c_DateCorrectConst
-
1
)
*
c_msPerDay
)
).
getUTCMonth
()
+
1
),
true
,
0
);
return
this
.
setCA
(
new
cNumber
(
(
new
Date
(
(
(
val
==
0
?
1
:
val
)
-
AscCommonExcel
.
c_DateCorrectConst
-
1
)
*
c_msPerDay
)
).
getUTCMonth
()
+
1
),
true
,
0
);
}
else
return
this
.
setCA
(
new
cNumber
(
(
new
Date
(
(
(
val
==
0
?
1
:
val
)
-
c_DateCorrectConst
)
*
c_msPerDay
)
).
getUTCMonth
()
+
1
),
true
,
0
);
return
this
.
setCA
(
new
cNumber
(
(
new
Date
(
(
(
val
==
0
?
1
:
val
)
-
AscCommonExcel
.
c_DateCorrectConst
)
*
c_msPerDay
)
).
getUTCMonth
()
+
1
),
true
,
0
);
};
cMONTH
.
prototype
.
getInfo
=
function
()
{
return
{
...
...
@@ -1089,29 +1087,29 @@ cNETWORKDAYS.prototype.Calculate = function ( arg ) {
if
(
val0
<
0
)
return
this
.
setCA
(
new
cError
(
cErrorType
.
not_numeric
),
true
);
else
if
(
!
bDate1904
)
{
else
if
(
!
AscCommon
.
bDate1904
)
{
if
(
val0
<
60
)
val0
=
new
Date
(
(
val0
-
c_DateCorrectConst
)
*
c_msPerDay
);
val0
=
new
Date
(
(
val0
-
AscCommonExcel
.
c_DateCorrectConst
)
*
c_msPerDay
);
else
if
(
val0
==
60
)
val0
=
new
Date
(
(
val0
-
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
val0
=
new
Date
(
(
val0
-
AscCommonExcel
.
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
else
val0
=
new
Date
(
(
val0
-
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
val0
=
new
Date
(
(
val0
-
AscCommonExcel
.
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
}
else
val0
=
new
Date
(
(
val0
-
c_DateCorrectConst
)
*
c_msPerDay
);
val0
=
new
Date
(
(
val0
-
AscCommonExcel
.
c_DateCorrectConst
)
*
c_msPerDay
);
if
(
val1
<
0
)
return
this
.
setCA
(
new
cError
(
cErrorType
.
not_numeric
),
true
);
else
if
(
!
bDate1904
)
{
else
if
(
!
AscCommon
.
bDate1904
)
{
if
(
val1
<
60
)
val1
=
new
Date
(
(
val1
-
c_DateCorrectConst
)
*
c_msPerDay
);
val1
=
new
Date
(
(
val1
-
AscCommonExcel
.
c_DateCorrectConst
)
*
c_msPerDay
);
else
if
(
val1
==
60
)
val1
=
new
Date
(
(
val1
-
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
val1
=
new
Date
(
(
val1
-
AscCommonExcel
.
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
else
val1
=
new
Date
(
(
val1
-
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
val1
=
new
Date
(
(
val1
-
AscCommonExcel
.
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
}
else
val1
=
new
Date
(
(
val1
-
c_DateCorrectConst
)
*
c_msPerDay
);
val1
=
new
Date
(
(
val1
-
AscCommonExcel
.
c_DateCorrectConst
)
*
c_msPerDay
);
var
holidays
=
[];
...
...
@@ -1264,7 +1262,7 @@ cSECOND.prototype.Calculate = function ( arg ) {
val
=
d
.
value
;
}
else
val
=
(
d
.
getTime
()
/
1000
-
d
.
getTimezoneOffset
()
*
60
)
/
c_sPerDay
+
(
c_DateCorrectConst
+
(
bDate1904
?
0
:
1
)
);
val
=
(
d
.
getTime
()
/
1000
-
d
.
getTimezoneOffset
()
*
60
)
/
c_sPerDay
+
(
AscCommonExcel
.
c_DateCorrectConst
+
(
AscCommon
.
bDate1904
?
0
:
1
)
);
}
else
{
val
=
arg0
.
tocNumber
().
getValue
();
...
...
@@ -1508,7 +1506,7 @@ cWEEKDAY.prototype.Calculate = function ( arg ) {
if
(
arg0
.
getValue
()
<
0
)
return
this
.
value
=
new
cError
(
cErrorType
.
wrong_value_type
);
return
this
.
value
=
new
cNumber
(
weekday
[
new
Date
(
(
arg0
.
getValue
()
-
(
c_DateCorrectConst
+
1
))
*
c_msPerDay
).
getUTCDay
()]
);
return
this
.
value
=
new
cNumber
(
weekday
[
new
Date
(
(
arg0
.
getValue
()
-
(
AscCommonExcel
.
c_DateCorrectConst
+
1
))
*
c_msPerDay
).
getUTCDay
()]
);
}
cWEEKDAY
.
prototype
.
getInfo
=
function
()
{
return
{
...
...
@@ -1684,16 +1682,16 @@ cWORKDAY.prototype.Calculate = function ( arg ) {
if
(
val0
<
0
)
return
this
.
setCA
(
new
cError
(
cErrorType
.
not_numeric
),
true
);
else
if
(
!
bDate1904
)
{
else
if
(
!
AscCommon
.
bDate1904
)
{
if
(
val0
<
60
)
val0
=
new
Date
(
(
val0
-
c_DateCorrectConst
)
*
c_msPerDay
);
val0
=
new
Date
(
(
val0
-
AscCommonExcel
.
c_DateCorrectConst
)
*
c_msPerDay
);
else
if
(
val0
==
60
)
val0
=
new
Date
(
(
val0
-
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
val0
=
new
Date
(
(
val0
-
AscCommonExcel
.
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
else
val0
=
new
Date
(
(
val0
-
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
val0
=
new
Date
(
(
val0
-
AscCommonExcel
.
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
}
else
val0
=
new
Date
(
(
val0
-
c_DateCorrectConst
)
*
c_msPerDay
);
val0
=
new
Date
(
(
val0
-
AscCommonExcel
.
c_DateCorrectConst
)
*
c_msPerDay
);
if
(
arg2
)
{
if
(
arg2
instanceof
cArea
||
arg2
instanceof
cArea3D
)
{
...
...
@@ -1719,16 +1717,16 @@ cWORKDAY.prototype.Calculate = function ( arg ) {
}
for
(
var
i
=
0
;
i
<
holidays
.
length
;
i
++
)
{
if
(
!
bDate1904
)
{
if
(
!
AscCommon
.
bDate1904
)
{
if
(
holidays
[
i
].
getValue
()
<
60
)
holidays
[
i
]
=
new
Date
(
(
holidays
[
i
].
getValue
()
-
c_DateCorrectConst
)
*
c_msPerDay
);
holidays
[
i
]
=
new
Date
(
(
holidays
[
i
].
getValue
()
-
AscCommonExcel
.
c_DateCorrectConst
)
*
c_msPerDay
);
else
if
(
holidays
[
i
]
==
60
)
holidays
[
i
]
=
new
Date
(
(
holidays
[
i
].
getValue
()
-
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
holidays
[
i
]
=
new
Date
(
(
holidays
[
i
].
getValue
()
-
AscCommonExcel
.
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
else
holidays
[
i
]
=
new
Date
(
(
holidays
[
i
].
getValue
()
-
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
holidays
[
i
]
=
new
Date
(
(
holidays
[
i
].
getValue
()
-
AscCommonExcel
.
c_DateCorrectConst
-
1
)
*
c_msPerDay
);
}
else
holidays
[
i
]
=
new
Date
(
(
holidays
[
i
].
getValue
()
-
c_DateCorrectConst
)
*
c_msPerDay
);
holidays
[
i
]
=
new
Date
(
(
holidays
[
i
].
getValue
()
-
AscCommonExcel
.
c_DateCorrectConst
)
*
c_msPerDay
);
}
function
notAHolidays
(
date
)
{
...
...
@@ -1823,7 +1821,7 @@ cYEAR.prototype.Calculate = function ( arg ) {
return
this
.
setCA
(
new
cError
(
cErrorType
.
wrong_value_type
),
true
);
}
else
val
=
Math
.
floor
(
(
d
.
getTime
()
/
1000
-
d
.
getTimezoneOffset
()
*
60
)
/
c_sPerDay
+
(
c_DateCorrectConst
+
(
bDate1904
?
0
:
1
)
)
);
val
=
Math
.
floor
(
(
d
.
getTime
()
/
1000
-
d
.
getTimezoneOffset
()
*
60
)
/
c_sPerDay
+
(
AscCommonExcel
.
c_DateCorrectConst
+
(
AscCommon
.
bDate1904
?
0
:
1
)
)
);
}
else
{
val
=
arg0
.
tocNumber
().
getValue
();
...
...
@@ -1832,7 +1830,7 @@ cYEAR.prototype.Calculate = function ( arg ) {
if
(
val
<
0
)
return
this
.
setCA
(
new
cError
(
cErrorType
.
not_numeric
),
true
,
0
);
else
return
this
.
setCA
(
new
cNumber
(
(
new
Date
(
(
val
-
(
c_DateCorrectConst
+
1
))
*
c_msPerDay
)).
getUTCFullYear
()
),
true
,
0
);
return
this
.
setCA
(
new
cNumber
(
(
new
Date
(
(
val
-
(
AscCommonExcel
.
c_DateCorrectConst
+
1
))
*
c_msPerDay
)).
getUTCFullYear
()
),
true
,
0
);
}
cYEAR
.
prototype
.
getInfo
=
function
()
{
return
{
...
...
cell/model/FormulaObjects/parserFormula.js
View file @
b38d0c3c
...
...
@@ -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
))
{
...
...
@@ -5080,7 +5079,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_Date
Correct
Const
;
window
[
'
AscCommonExcel
'
].
c_DateCorrectConst
=
c_Date
1900
Const
;
window
[
'
AscCommonExcel
'
].
c_sPerDay
=
c_sPerDay
;
window
[
'
AscCommonExcel
'
].
c_msPerDay
=
c_msPerDay
;
...
...
common/NumFormat.js
View file @
b38d0c3c
...
...
@@ -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
{
...
...
common/commonDefines.js
View file @
b38d0c3c
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment