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
3f8bc40a
Commit
3f8bc40a
authored
Aug 02, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add function for WORKDAY.INTL formula
parent
6a95a35c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
0 deletions
+71
-0
cell/model/FormulaObjects/dateandtimeFunctions.js
cell/model/FormulaObjects/dateandtimeFunctions.js
+71
-0
No files found.
cell/model/FormulaObjects/dateandtimeFunctions.js
View file @
3f8bc40a
...
...
@@ -1767,6 +1767,77 @@
return
this
.
value
=
calcDate
();
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cWORKDAY_INTL
()
{
this
.
name
=
"
WORKDAY.INTL
"
;
this
.
value
=
null
;
this
.
argumentsCurrent
=
0
;
}
cWORKDAY_INTL
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cWORKDAY_INTL
.
prototype
.
constructor
=
cWORKDAY_INTL
;
cWORKDAY_INTL
.
prototype
.
argumentsMin
=
2
;
cWORKDAY_INTL
.
prototype
.
argumentsMax
=
4
;
cWORKDAY_INTL
.
prototype
.
numFormat
=
AscCommonExcel
.
cNumFormatNone
;
cWORKDAY_INTL
.
prototype
.
Calculate
=
function
(
arg
)
{
var
t
=
this
;
var
tempArgs
=
arg
[
2
]
?
[
arg
[
0
],
arg
[
1
],
arg
[
2
]]
:
[
arg
[
0
],
arg
[
1
]];
var
oArguments
=
this
.
_prepareArguments
(
tempArgs
,
arguments
[
1
]);
var
argClone
=
oArguments
.
args
;
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
1
]
=
argClone
[
1
].
tocNumber
();
var
argError
;
if
(
argError
=
this
.
_checkErrorArg
(
argClone
))
{
return
this
.
value
=
argError
;
}
var
arg0
=
argClone
[
0
],
arg1
=
argClone
[
1
],
arg2
=
argClone
[
2
],
arg3
=
arg
[
3
];
var
val0
=
arg0
.
getValue
();
if
(
val0
<
0
)
{
return
this
.
value
=
new
cError
(
cErrorType
.
not_numeric
);
}
val0
=
getCorrectDate
(
val0
);
//Weekend
var
weekends
=
getWeekends
(
arg2
);
if
(
weekends
instanceof
cError
)
{
return
this
.
value
=
weekends
;
}
//Holidays
var
holidays
=
getHolidays
(
arg3
);
if
(
holidays
instanceof
cError
)
{
return
this
.
value
=
holidays
;
}
var
calcDate
=
function
(){
var
dif
=
arg1
.
getValue
(),
count
=
1
,
dif1
=
dif
>
0
?
1
:
dif
<
0
?
-
1
:
0
,
val
,
date
=
val0
;
while
(
Math
.
abs
(
dif
)
>
count
)
{
date
=
new
Date
(
val0
.
getTime
()
+
dif1
*
c_msPerDay
);
if
(
_includeInHolidays
(
date
,
holidays
)
&&
!
weekends
[
date
.
getUTCDay
()])
{
count
++
;
}
dif
>=
0
?
dif1
++
:
dif1
--
;
}
date
=
new
Date
(
val0
.
getTime
()
+
dif1
*
c_msPerDay
);
val
=
date
.
getExcelDate
();
if
(
val
<
0
)
{
return
new
cError
(
cErrorType
.
not_numeric
);
}
return
t
.
setCalcValue
(
new
cNumber
(
val
),
14
);
};
return
this
.
value
=
calcDate
();
};
/**
* @constructor
* @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