Mercurial > code > home > repos > front-door-display
view src/FdClock.ts @ 20:e8c90d893919
layout and sorting
author | drewp@bigasterisk.com |
---|---|
date | Mon, 26 Aug 2024 16:17:49 -0700 |
parents | 472003015880 |
children |
line wrap: on
line source
import { css, html, LitElement } from "lit"; import { shared } from "./shared"; import { customElement } from "lit/decorators.js"; @customElement("fd-clock") export class FdClock extends LitElement { constructor() { super(); setInterval(() => { this.requestUpdate(); }, 1000); } static styles = [ shared, css` `, ]; render() { const t = new Date(); const h = t.getHours().toString().padStart(2, "0"); const m = t.getMinutes().toString().padStart(2, "0"); const s = t.getSeconds().toString().padStart(2, "0"); return html` <span class="t">${h}:${m.slice(0, 2)}:${s.slice(0, 2)}</span> `; } }