Skip to content

Commit cb4cc83

Browse files
authored
Merge pull request #173 from vedansh-5/dateBug
Date bug
2 parents 67278cc + d1fc7a3 commit cb4cc83

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

src/scripts/popup.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,29 @@ document.addEventListener('DOMContentLoaded', function () {
269269
chrome.storage.local.get([
270270
'selectedTimeframe',
271271
'lastWeekContribution',
272-
'yesterdayContribution'
272+
'yesterdayContribution',
273+
'startingDate',
274+
'endingDate',
273275
], (items) => {
274276
console.log('Restoring state:', items);
275277

278+
if(items.startingDate && items.endingDate && !items.lastWeekContribution && !items.yesterdayContribution) {
279+
const startDateInput = document.getElementById('startingDate');
280+
const endDateInput = document.getElementById('endingDate');
281+
282+
if(startDateInput && endDateInput) {
283+
startDateInput.value = items.startingDate;
284+
endDateInput.value = items.endingDate;
285+
startDateInput.readOnly = false;
286+
endDateInput.readOnly = false;
287+
}
288+
document.querySelectorAll('input[name="timeframe"]').forEach(radio => {
289+
radio.checked = false;
290+
radio.dataset.wasChecked = 'false';
291+
})
292+
return;
293+
}
294+
276295
if (!items.selectedTimeframe) {
277296
items.selectedTimeframe = 'yesterdayContribution';
278297
items.lastWeekContribution = false;
@@ -597,4 +616,4 @@ if (cacheInput) {
597616
});
598617
});
599618

600-
}
619+
}

src/scripts/scrumHelper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ function allIncluded(outputTarget = 'email') {
122122
handleLastWeekContributionChange();
123123
} else if (items.yesterdayContribution) {
124124
handleYesterdayContributionChange();
125-
} else if (items.startDate && items.endingDate) {
125+
} else if (items.startingDate && items.endingDate) {
126126
startingDate = items.startingDate;
127127
endingDate = items.endingDate;
128128
} else {
129-
handleLastWeekContributionChange(); //when no date is stored, i.e on fresh unpack - default to last week.
129+
handleLastWeekContributionChange(); //when no date is stored i.e on fresh unpack - default to last week.
130130
if (outputTarget === 'popup') {
131131
chrome.storage.local.set({ lastWeekContribution: true, yesterdayContribution: false });
132132
}

0 commit comments

Comments
 (0)