forked from XimeX/usrspace-browser-addon
add time element for event date
This commit is contained in:
parent
13219a7f8e
commit
bcec944781
|
@ -20,14 +20,20 @@ browser.runtime.getBackgroundPage().then((page) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const updateNextEvent = (nextEvent) => {
|
const updateNextEvent = (nextEvent) => {
|
||||||
|
const beginDate = new Date(nextEvent.begin);
|
||||||
|
|
||||||
const calendarElement = document.getElementById('calendar');
|
const calendarElement = document.getElementById('calendar');
|
||||||
const strongElement = document.createElement('strong');
|
const strongElement = document.createElement('strong');
|
||||||
|
const timeElement = document.createElement('time');
|
||||||
strongElement.textContent = nextEvent.name;
|
strongElement.textContent = nextEvent.name;
|
||||||
const dateNode = document.createTextNode(' ' + new Date(nextEvent.begin).toLocaleString());
|
timeElement.datetime = beginDate.toISOString();
|
||||||
|
const dateNode = document.createTextNode(beginDate.toLocaleString());
|
||||||
// calendarElement.innerText = '';
|
// calendarElement.innerText = '';
|
||||||
calendarElement.innerHTML = '<img src="../icons/font-awesome/clock-regular.svg" width="19" height="19" alt="Clock" />';
|
calendarElement.innerHTML = '<img src="../icons/font-awesome/clock-regular.svg" width="19" height="19" alt="Clock" />';
|
||||||
calendarElement.append(strongElement);
|
calendarElement.append(strongElement);
|
||||||
calendarElement.append(dateNode);
|
calendarElement.append(document.createTextNode(' '));
|
||||||
|
calendarElement.append(timeElement);
|
||||||
|
timeElement.append(dateNode);
|
||||||
if (nextEvent.location) {
|
if (nextEvent.location) {
|
||||||
const locationNode = document.createTextNode(' (' + nextEvent.location + ')');
|
const locationNode = document.createTextNode(' (' + nextEvent.location + ')');
|
||||||
calendarElement.append(locationNode);
|
calendarElement.append(locationNode);
|
||||||
|
|
Loading…
Reference in a new issue