mirror of
https://github.com/kmein/niveum
synced 2026-03-20 03:51:07 +01:00
feat(radio-news): set sensible default
This commit is contained in:
@@ -103,15 +103,28 @@
|
|||||||
request.open("POST", newsEndpoint, false); // synchronous
|
request.open("POST", newsEndpoint, false); // synchronous
|
||||||
request.send(
|
request.send(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
from: isoString(new Date(formData.get("from"))),
|
from: formData.get("from") + ":00Z",
|
||||||
to: isoString(new Date(formData.get("to"))),
|
to: formData.get("to") + ":00Z",
|
||||||
text: formData.get("text"),
|
text: formData.get("text"),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setDate() {
|
||||||
|
let now = new Date();
|
||||||
|
document.getElementById("time-from").value = now
|
||||||
|
.toISOString()
|
||||||
|
.slice(0, 16);
|
||||||
|
|
||||||
|
now.setHours(now.getHours() + 1);
|
||||||
|
document.getElementById("time-to").value = now
|
||||||
|
.toISOString()
|
||||||
|
.slice(0, 16);
|
||||||
|
}
|
||||||
|
|
||||||
window.onload = () => {
|
window.onload = () => {
|
||||||
|
setDate();
|
||||||
setNextNews();
|
setNextNews();
|
||||||
fetchNews();
|
fetchNews();
|
||||||
};
|
};
|
||||||
@@ -122,10 +135,10 @@
|
|||||||
<section>
|
<section>
|
||||||
<h1>Submit news</h1>
|
<h1>Submit news</h1>
|
||||||
<form onsubmit="sendNews(event)">
|
<form onsubmit="sendNews(event)">
|
||||||
<label>Start date</label>
|
<label>Start date (UTC)</label>
|
||||||
<input type="datetime-local" name="from" required />
|
<input type="datetime-local" id="time-from" name="from" required />
|
||||||
<label>End date</label>
|
<label>End date (UTC)</label>
|
||||||
<input type="datetime-local" name="to" required />
|
<input type="datetime-local" id="time-to" name="to" required />
|
||||||
<label>News text</label>
|
<label>News text</label>
|
||||||
<textarea name="text" rows="10" required></textarea>
|
<textarea name="text" rows="10" required></textarea>
|
||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
|
|||||||
Reference in New Issue
Block a user