Hello,
I want to display the current time in my application.
How can I have a “wall clock” in my app (Slate or Workshop) ?
Hello,
I want to display the current time in my application.
How can I have a “wall clock” in my app (Slate or Workshop) ?
You can create a Slate application, and create the clock there.
Configuration in Slate:
HTML
<p id="text"></p>
Javascript
function updateTimestamp() {
const now = new Date();
const timestamp = now.toLocaleString(); // You can customize the format using options
document.getElementById('text').textContent = timestamp;
}
updateTimestamp()
setInterval(updateTimestamp, 1000)
You will obtain:
You should of course personalize it the way you like with CSS.
More docs with Code sandbox: https://www.palantir.com/docs/foundry/slate/widgets-advanced/#code-sandbox
If you need it in Workshop, you can embed the Slate application in Workshop with the “Slate embedding” widget.