fix partial opening hours bug
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
This commit is contained in:
Родитель
9b4031d331
Коммит
6b2ed4ef37
24
js/script.js
24
js/script.js
|
@ -1463,21 +1463,23 @@
|
|||
var isCurrentlyOpen = oh.getState();
|
||||
var changeDt = oh.getNextChange();
|
||||
var currentDt = new Date();
|
||||
var dtDiff = changeDt.getTime() - currentDt.getTime();
|
||||
dtDiff = dtDiff / 60000; // get diff in minutes
|
||||
if (oh.getState()) { // is open?
|
||||
desc += '<span class="poi-open">' + t('maps', 'Open') + ' </span>';
|
||||
if (dtDiff <= 60) {
|
||||
desc += '<span class="poi-closes">, ' + t('maps', 'closes in {nb} minutes', {nb: parseInt(dtDiff)}) + '</span>';
|
||||
if (changeDt) {
|
||||
var dtDiff = changeDt.getTime() - currentDt.getTime();
|
||||
dtDiff = dtDiff / 60000; // get diff in minutes
|
||||
if (isCurrentlyOpen) {
|
||||
desc += '<span class="poi-open">' + t('maps', 'Open') + ' </span>';
|
||||
if (dtDiff <= 60) {
|
||||
desc += '<span class="poi-closes">, ' + t('maps', 'closes in {nb} minutes', {nb: parseInt(dtDiff)}) + '</span>';
|
||||
}
|
||||
else {
|
||||
desc += '<span> ' + t('maps', 'until {date}', {date: changeDt.toLocaleTimeString()}) + '</span>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
desc += '<span> ' + t('maps', 'until {date}', {date: changeDt.toLocaleTimeString()}) + '</span>';
|
||||
desc += '<span class="poi-closed">' + t('maps', 'Closed') + ' </span>';
|
||||
desc += '<span class="poi-opens">' + t('maps', 'opens at {date}', {date: changeDt.toLocaleTimeString()}) + '</span>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
desc += '<span class="poi-closed">' + t('maps', 'Closed') + ' </span>';
|
||||
desc += '<span class="poi-opens">' + t('maps', 'opens at {date}', {date: changeDt.toLocaleTimeString()}) + '</span>';
|
||||
}
|
||||
desc += '<img id="opening-hours-table-toggle-collapse" src="' +
|
||||
OC.filePath('maps', 'img', 'triangle-s.svg') +
|
||||
'" /><img id="opening-hours-table-toggle-expand" src="' +
|
||||
|
|
Загрузка…
Ссылка в новой задаче