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
ca60bfe9
Commit
ca60bfe9
authored
Jul 28, 2014
by
Johannes Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed error propagaytion
parent
3c7ade5d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletion
+33
-1
index.js
index.js
+3
-1
dateView.js
lib/dateView.js
+30
-0
No files found.
index.js
View file @
ca60bfe9
...
...
@@ -16,3 +16,5 @@ function getOHIndex(incl, excl, date, plz, cb) {
}
module
.
exports
.
getOHIndex
=
getOHIndex
;
module
.
exports
.
dataArray
=
dateArray
;
module
.
exports
.
dateView
=
dateView
;
lib/dateView.js
View file @
ca60bfe9
...
...
@@ -176,5 +176,35 @@ function getPropperEpochSpan(now) {
return
[
epochStart
,
epochEnd
];
}
function
asString
(
data
,
now
)
{
var
mNow
=
moment
(
now
);
var
open
=
false
;
var
nowT
=
now
.
getTime
();
var
idx
=
0
;
while
(
nowT
>=
data
[
idx
][
0
].
getTime
()
&&
idx
<
data
.
length
)
{
if
(
data
[
idx
][
1
].
getTime
()
>=
nowT
)
open
=
true
;
idx
++
;
}
if
(
open
)
{
idx
--
;
return
mNow
.
format
(
"dddd"
)
+
", jetzt bis "
+
moment
(
data
[
idx
][
1
]).
format
(
"LT"
)
+
" geöffnet"
;
}
else
{
var
retStr
=
"Jetzt nicht geöffnet, "
;
if
(
idx
==
data
.
length
)
{
return
retStr
+
"nächter Öffnungstermin unbekannt"
;
}
else
{
var
nextM
=
moment
(
data
[
idx
][
0
]);
return
retStr
+
"wieder geöffnet am "
+
nextM
.
format
(
"dddd"
)
+
", "
+
nextM
.
format
(
"l"
)
+
" ab "
+
nextM
.
format
(
"LT"
);
}
}
}
module
.
exports
.
asString
=
asString
;
module
.
exports
.
weekView
=
createWeekView
;
module
.
exports
.
monthView
=
create3MonthView
;
module
.
exports
.
getView
=
getView
;
module
.
exports
.
getPropperEpochSpan
=
getPropperEpochSpan
;
\ No newline at end of file
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