-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubmitform.js
More file actions
12 lines (12 loc) · 788 Bytes
/
Copy pathsubmitform.js
File metadata and controls
12 lines (12 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
chrome.storage.sync.get(['startYear','startMonth','startDay','endYear','endMonth','endDay'], function(result) {
const dtf = new Intl.DateTimeFormat('en', {year:"numeric",month:"short",day:"2-digit"});
startDate = new Date(result['startYear'], result['startMonth'], result['startDay']);
[{ value: mo },,{ value: da },,{ value: ye }] = dtf.formatToParts(startDate);
document.getElementById("startDate").value = `${da}-${mo}-${ye}`;
endDate = new Date(result['endYear'], result['endMonth'], result['endDay']);
[{ value: mo },,{ value: da },,{ value: ye }] = dtf.formatToParts(endDate);
var endInput = document.getElementById("endDate");
endInput.value = `${da}-${mo}-${ye}`;
chrome.runtime.sendMessage({action: "submit"});
endInput.form.submit();
});