Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
opening-hours
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
regionalkauf
opening-hours
Commits
fd4c0558
Commit
fd4c0558
authored
Jun 24, 2014
by
Johannes Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored
parent
11cafb58
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
30 deletions
+31
-30
test.js
test.js
+24
-5
timeUtils.js
timeUtils.js
+7
-25
No files found.
test.js
View file @
fd4c0558
var
x
=
new
Date
();
var
y
=
new
Date
(
x
);
y
.
setDate
(
1
);
var
utils
=
require
(
'./timeUtils'
);
//gibt zu betrachtenden Zeitraum an.
var
_epochStart
=
new
Date
(
2014
,
5
,
24
,
0
);
var
_epochEnd
=
new
Date
(
_epochStart
.
getTime
()
+
100
*
24
*
3600000
);
console
.
log
(
x
);
console
.
log
(
y
);
\ No newline at end of file
console
.
log
(
"epochStart"
,
_epochStart
);
console
.
log
(
"epochEnd "
,
_epochEnd
);
//test
//var a = _cyclicInterval(new Date(2014, 5, 23, 9), new Date(2014, 5, 23, 14), 7 * 24 * 3600 * 1000);
//var b = _cyclicInterval(new Date(2014, 5, 23, 10), new Date(2014, 5, 23, 18), 7 * 24 * 3600 * 1000);
//var c = [[new Date(2014, 5, 23, 13), new Date(2014, 6, 6, 10)]];
//var x = andNotOperator(a, b);
//var y = andNotOperator(a, c);
//console.log(y);
//var workday = standardFromTillDay(1, 6, {h: 9, m: 0}, {h: 11, m: 45}, _epochStart, _epochEnd, 14);
//console.log(workday);
var
t
=
utils
.
cyclicFromTillDay
(
1
,
5
,
-
1
,
{
h
:
9
,
m
:
0
},
{
h
:
18
,
m
:
29
},
_epochStart
,
_epochEnd
);
var
t2
=
utils
.
cyclicFromTillDay
(
2
,
2
,
-
1
,
{
h
:
9
,
m
:
0
},
{
h
:
18
,
m
:
29
},
_epochStart
,
_epochEnd
);
var
res
=
utils
.
andNotOperator
(
t
,
t2
);
console
.
log
(
res
);
\ No newline at end of file
app
.js
→
timeUtils
.js
View file @
fd4c0558
//gibt zu betrachtenden Zeitraum an.
var
_epochStart
=
new
Date
(
2014
,
5
,
24
,
0
);
var
_epochEnd
=
new
Date
(
_epochStart
.
getTime
()
+
100
*
24
*
3600000
);
console
.
log
(
"epochStart"
,
_epochStart
);
console
.
log
(
"epochEnd "
,
_epochEnd
);
function
_cyclicInterval
(
from
,
until
,
interval
,
epochStart
,
epochEnd
)
{
if
(
from
>=
until
)
throw
new
Error
(
"startDate cant be greater than endDate"
);
var
resultArray
=
[];
...
...
@@ -234,21 +227,10 @@ function andNotOperator(interval1, interval2) {
return
andOperator
(
interval1
,
interval2
);
}
//test
//var a = _cyclicInterval(new Date(2014, 5, 23, 9), new Date(2014, 5, 23, 14), 7 * 24 * 3600 * 1000);
//var b = _cyclicInterval(new Date(2014, 5, 23, 10), new Date(2014, 5, 23, 18), 7 * 24 * 3600 * 1000);
//var c = [[new Date(2014, 5, 23, 13), new Date(2014, 6, 6, 10)]];
//var x = andNotOperator(a, b);
//var y = andNotOperator(a, c);
//console.log(y);
//var workday = standardFromTillDay(1, 6, {h: 9, m: 0}, {h: 11, m: 45}, _epochStart, _epochEnd, 14);
//console.log(workday);
var
t
=
cyclicFromTillDay
(
1
,
5
,
-
1
,
{
h
:
9
,
m
:
0
},
{
h
:
18
,
m
:
29
},
_epochStart
,
_epochEnd
);
var
t2
=
cyclicFromTillDay
(
2
,
2
,
-
1
,
{
h
:
9
,
m
:
0
},
{
h
:
18
,
m
:
29
},
_epochStart
,
_epochEnd
);
var
res
=
andNotOperator
(
t
,
t2
);
console
.
log
(
res
);
\ No newline at end of file
module
.
exports
.
standard
=
standard
;
module
.
exports
.
standardFromTillDay
=
standardFromTillDay
;
module
.
exports
.
cyclic
=
cyclic
;
module
.
exports
.
cyclicFromTillDay
=
cyclicFromTillDay
;
module
.
exports
.
orOperator
=
orOperator
;
module
.
exports
.
andOperator
=
andOperator
;
module
.
exports
.
andNotOperator
=
andNotOperator
;
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