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
Expand all
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
This diff is collapsed.
Click to expand it.
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