Skip to content

Commit 1ba238d

Browse files
committed
Fix empty time interval
1 parent 3e01103 commit 1ba238d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/scripts/webact.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,15 @@ function getTabsFromStorage(tabs) {
155155
ui.setActiveTooltipe(currentTab);
156156
}
157157

158-
function getTabsForTimeChart(targetTabs){
158+
function getTabsForTimeChart(targetTabs) {
159159
var resultArr = [];
160-
targetTabs.forEach(function (name){
161-
var current = name.days.forEach(function (item){
162-
if (item.date == new Date().toLocaleDateString("en-US")){
163-
item.time.forEach(function (time){
164-
resultArr.push({'domain':name.url, 'interval':time});
160+
targetTabs.forEach(function (name) {
161+
name.days.forEach(function (item) {
162+
if (item.date == new Date().toLocaleDateString("en-US") && item.time !== undefined) {
163+
item.time.forEach(function (time) {
164+
resultArr.push({ 'domain': name.url, 'interval': time });
165165
})
166-
}
166+
}
167167
});
168168
});
169169
return resultArr;
@@ -173,7 +173,7 @@ function getTabsForExpander() {
173173
storage.loadTabs(STORAGE_TABS, getTabsFromStorageForExpander);
174174
}
175175

176-
function drawTimeChart(){
176+
function drawTimeChart() {
177177
ui.drawTimeChart(getTabsForTimeChart(currentTabListForToday));
178178
}
179179

@@ -311,11 +311,11 @@ function getTabsByDays(tabs) {
311311
return new Date(a.date) - new Date(b.date);
312312
});
313313

314-
var getDaysArray = function(start, end) {
314+
var getDaysArray = function (start, end) {
315315
let first = start;
316316
let second = end;
317317
var arr = [];
318-
for (let i = first; i <= second; i = new Date(i.setDate(i.getDate() + 1))){
318+
for (let i = first; i <= second; i = new Date(i.setDate(i.getDate() + 1))) {
319319
arr.push(new Date(i).toLocaleDateString("en-US"));
320320
}
321321
return arr;

0 commit comments

Comments
 (0)