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
5553c680
Commit
5553c680
authored
Aug 04, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ISOWEEKNUM formula
parent
1d36f679
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
21 deletions
+73
-21
cell/model/FormulaObjects/_xlfnFunctions.js
cell/model/FormulaObjects/_xlfnFunctions.js
+3
-18
cell/model/FormulaObjects/dateandtimeFunctions.js
cell/model/FormulaObjects/dateandtimeFunctions.js
+70
-3
No files found.
cell/model/FormulaObjects/_xlfnFunctions.js
View file @
5553c680
...
@@ -48,8 +48,6 @@
...
@@ -48,8 +48,6 @@
var
cFormulaFunctionGroup
=
AscCommonExcel
.
cFormulaFunctionGroup
;
var
cFormulaFunctionGroup
=
AscCommonExcel
.
cFormulaFunctionGroup
;
/*new funcions with _xlnf-prefix*/
/*new funcions with _xlnf-prefix*/
cFormulaFunctionGroup
[
'
DateAndTime
'
]
=
cFormulaFunctionGroup
[
'
DateAndTime
'
]
||
[];
cFormulaFunctionGroup
[
'
DateAndTime
'
].
push
(
cISOWEEKNUM
);
cFormulaFunctionGroup
[
'
TextAndData
'
]
=
cFormulaFunctionGroup
[
'
TextAndData
'
]
||
[];
cFormulaFunctionGroup
[
'
TextAndData
'
]
=
cFormulaFunctionGroup
[
'
TextAndData
'
]
||
[];
cFormulaFunctionGroup
[
'
TextAndData
'
].
push
(
cDBCS
,
cUNICHAR
,
cUNICODE
);
cFormulaFunctionGroup
[
'
TextAndData
'
].
push
(
cDBCS
,
cUNICHAR
,
cUNICODE
);
cFormulaFunctionGroup
[
'
Statistical
'
]
=
cFormulaFunctionGroup
[
'
Statistical
'
]
||
[];
cFormulaFunctionGroup
[
'
Statistical
'
]
=
cFormulaFunctionGroup
[
'
Statistical
'
]
||
[];
...
@@ -65,10 +63,9 @@
...
@@ -65,10 +63,9 @@
cFormulaFunctionGroup
[
'
Information
'
].
push
(
cSHEET
,
cSHEETS
);
cFormulaFunctionGroup
[
'
Information
'
].
push
(
cSHEET
,
cSHEETS
);
cFormulaFunctionGroup
[
'
NotRealised
'
]
=
cFormulaFunctionGroup
[
'
NotRealised
'
]
||
[];
cFormulaFunctionGroup
[
'
NotRealised
'
]
=
cFormulaFunctionGroup
[
'
NotRealised
'
]
||
[];
cFormulaFunctionGroup
[
'
NotRealised
'
].
push
(
cISOWEEKNUM
,
cFormulaFunctionGroup
[
'
NotRealised
'
].
push
(
cDBCS
,
cUNICHAR
,
cUNICODE
,
cBINOM_DIST_RANGE
,
cF_TEST
,
cFORECAST_ETS
,
cDBCS
,
cUNICHAR
,
cUNICODE
,
cBINOM_DIST_RANGE
,
cF_TEST
,
cFORECAST_ETS
,
cFORECAST_ETS_CONFINT
,
cFORECAST_ETS_CONFINT
,
cFORECAST_ETS_SEASONALITY
,
cFORECAST_ETS_STAT
,
cHYPGEOM_DIST
,
cPDURATION
,
cAGGREGATE
,
cFORECAST_ETS_SEASONALITY
,
cFORECAST_ETS_STAT
,
cHYPGEOM_DIST
,
cPDURATION
,
cMUNIT
,
cFORMULATEXT
,
cSHEET
,
cSHEETS
);
cAGGREGATE
,
cMUNIT
,
cFORMULATEXT
,
cSHEET
,
cSHEETS
);
/**
/**
* @constructor
* @constructor
...
@@ -202,18 +199,6 @@
...
@@ -202,18 +199,6 @@
cHYPGEOM_DIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cHYPGEOM_DIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cHYPGEOM_DIST
.
prototype
.
constructor
=
cHYPGEOM_DIST
;
cHYPGEOM_DIST
.
prototype
.
constructor
=
cHYPGEOM_DIST
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cISOWEEKNUM
()
{
cBaseFunction
.
call
(
this
,
"
ISOWEEKNUM
"
);
this
.
isXLFN
=
true
;
}
cISOWEEKNUM
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cISOWEEKNUM
.
prototype
.
constructor
=
cISOWEEKNUM
;
/**
/**
* @constructor
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
* @extends {AscCommonExcel.cBaseFunction}
...
...
cell/model/FormulaObjects/dateandtimeFunctions.js
View file @
5553c680
...
@@ -412,9 +412,9 @@
...
@@ -412,9 +412,9 @@
cFormulaFunctionGroup
[
'
DateAndTime
'
]
=
cFormulaFunctionGroup
[
'
DateAndTime
'
]
||
[];
cFormulaFunctionGroup
[
'
DateAndTime
'
]
=
cFormulaFunctionGroup
[
'
DateAndTime
'
]
||
[];
cFormulaFunctionGroup
[
'
DateAndTime
'
].
push
(
cDATE
,
cDATEDIF
,
cDATEVALUE
,
cDAY
,
cDAYS
,
cDAYS360
,
cEDATE
,
cEOMONTH
,
cHOUR
,
cFormulaFunctionGroup
[
'
DateAndTime
'
].
push
(
cDATE
,
cDATEDIF
,
cDATEVALUE
,
cDAY
,
cDAYS
,
cDAYS360
,
cEDATE
,
cEOMONTH
,
c
MINUTE
,
cMONTH
,
cNETWORKDAYS
,
cNETWORKDAYS_INTL
,
cNOW
,
cSECOND
,
cTIME
,
cTIMEVALUE
,
cTODAY
,
cWEEKDAY
,
cWEEKNUM
,
c
HOUR
,
cISOWEEKNUM
,
cMINUTE
,
cMONTH
,
cNETWORKDAYS
,
cNETWORKDAYS_INTL
,
cNOW
,
cSECOND
,
cTIME
,
cTIMEVALUE
,
cTODAY
,
cWORKDAY
,
cWORKDAY_INTL
,
cYEAR
,
cYEARFRAC
);
cW
EEKDAY
,
cWEEKNUM
,
cW
ORKDAY
,
cWORKDAY_INTL
,
cYEAR
,
cYEARFRAC
);
/**
/**
* @constructor
* @constructor
...
@@ -1011,6 +1011,73 @@
...
@@ -1011,6 +1011,73 @@
}
}
};
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cISOWEEKNUM
()
{
this
.
name
=
"
ISOWEEKNUM
"
;
this
.
value
=
null
;
this
.
argumentsCurrent
=
0
;
}
cISOWEEKNUM
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cISOWEEKNUM
.
prototype
.
constructor
=
cISOWEEKNUM
;
cISOWEEKNUM
.
prototype
.
argumentsMin
=
1
;
cISOWEEKNUM
.
prototype
.
argumentsMax
=
1
;
cISOWEEKNUM
.
prototype
.
numFormat
=
AscCommonExcel
.
cNumFormatNone
;
cISOWEEKNUM
.
prototype
.
isXLFN
=
true
;
cISOWEEKNUM
.
prototype
.
Calculate
=
function
(
arg
)
{
var
oArguments
=
this
.
_prepareArguments
(
arg
,
arguments
[
1
],
true
);
var
argClone
=
oArguments
.
args
;
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
var
argError
;
if
(
argError
=
this
.
_checkErrorArg
(
argClone
))
{
return
this
.
value
=
argError
;
}
var
arg0
=
argClone
[
0
];
if
(
arg0
.
getValue
()
<
0
)
{
return
this
.
value
=
new
cError
(
cErrorType
.
not_numeric
);
}
function
WeekNumber
(
dt
,
iso
,
type
)
{
dt
.
setUTCHours
(
0
,
0
,
0
);
var
startOfYear
=
new
Date
(
Date
.
UTC
(
dt
.
getUTCFullYear
(),
0
,
1
));
var
endOfYear
=
new
Date
(
dt
);
endOfYear
.
setUTCMonth
(
11
);
endOfYear
.
setUTCDate
(
31
);
var
wk
=
parseInt
(((
dt
-
startOfYear
)
/
c_msPerDay
+
iso
[
startOfYear
.
getUTCDay
()])
/
7
);
if
(
type
)
{
switch
(
wk
)
{
case
0
:
// Возвращаем номер недели от 31 декабря предыдущего года
startOfYear
.
setUTCDate
(
0
);
return
WeekNumber
(
startOfYear
,
iso
,
type
);
case
53
:
// Если 31 декабря выпадает до четверга 1 недели следующего года
if
(
endOfYear
.
getUTCDay
()
<
4
)
{
return
new
cNumber
(
1
);
}
else
{
return
new
cNumber
(
wk
);
}
default
:
return
new
cNumber
(
wk
);
}
}
else
{
wk
=
parseInt
(((
dt
-
startOfYear
)
/
c_msPerDay
+
iso
[
startOfYear
.
getUTCDay
()]
+
7
)
/
7
);
return
new
cNumber
(
wk
);
}
}
var
weekdayStartDay
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
];
var
type
=
0
;
return
this
.
value
=
new
cNumber
(
WeekNumber
(
Date
.
prototype
.
getDateFromExcel
(
arg0
.
getValue
()),
weekdayStartDay
,
type
));
};
/**
/**
* @constructor
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
* @extends {AscCommonExcel.cBaseFunction}
...
...
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