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
e6122ba1
Commit
e6122ba1
authored
Nov 02, 2015
by
Johannes Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
raw events for new calendar
parent
611f1301
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
5 deletions
+18
-5
index.js
index.js
+17
-5
dateArray.js
lib/dateArray.js
+1
-0
No files found.
index.js
View file @
e6122ba1
var
dateArray
=
require
(
'./lib/dateArray'
);
var
dateView
=
require
(
'./lib/dateView'
);
var
splitMidnight
=
require
(
'./lib/timeUtils'
).
splitMidnight
;
function
mapEvents
(
dataObj
)
{
if
(
dataObj
.
intervals
)
{
return
splitMidnight
(
dataObj
.
intervals
).
map
(
function
(
evt
)
{
return
{
startDate
:
evt
[
0
],
endDate
:
evt
[
1
]
}
})
}
}
function
transform
(
x
)
{
function
transform
(
x
)
{
var
res
=
[];
var
res
=
[];
for
(
var
i
=
0
;
i
<
x
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
x
.
length
;
i
++
)
{
...
@@ -9,10 +24,6 @@ function transform(x) {
...
@@ -9,10 +24,6 @@ function transform(x) {
return
res
;
return
res
;
}
}
var
dateArray
=
require
(
'./lib/dateArray'
);
var
dateView
=
require
(
'./lib/dateView'
);
function
getOHIndex
(
info
,
today
,
cb
)
{
function
getOHIndex
(
info
,
today
,
cb
)
{
today
=
new
Date
(
today
.
getFullYear
(),
today
.
getMonth
(),
today
.
getDate
());
today
=
new
Date
(
today
.
getFullYear
(),
today
.
getMonth
(),
today
.
getDate
());
...
@@ -41,7 +52,8 @@ function getFull(info, now, cb) {
...
@@ -41,7 +52,8 @@ function getFull(info, now, cb) {
isOpen
:
short
.
isOpen
,
isOpen
:
short
.
isOpen
,
text
:
short
.
text
,
text
:
short
.
text
,
status
:
short
.
status
,
status
:
short
.
status
,
weekView
:
dateView
.
weekViewData
(
dataObj
,
now
)
weekView
:
dateView
.
weekViewData
(
dataObj
,
now
),
events
:
mapEvents
(
dataObj
)
};
};
cb
(
null
,
res
);
cb
(
null
,
res
);
})
})
...
...
lib/dateArray.js
View file @
e6122ba1
...
@@ -286,6 +286,7 @@ function wrapper(_epochSpan) {
...
@@ -286,6 +286,7 @@ function wrapper(_epochSpan) {
}
}
function
getOpeningHoursDatespan
(
data
)
{
function
getOpeningHoursDatespan
(
data
)
{
// TODO JB remove entries beyond epochespan
var
from
=
new
Date
(
data
[
'opening_date_from'
]);
var
from
=
new
Date
(
data
[
'opening_date_from'
]);
var
to
=
new
Date
(
data
[
'opening_date_to'
]);
var
to
=
new
Date
(
data
[
'opening_date_to'
]);
if
(
!
from
||
!
to
)
{
if
(
!
from
||
!
to
)
{
...
...
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