Mercurial > code > home > repos > front-door-display
view src/FdClock.ts @ 21:a90cb6927c7d default tip
fix countdown queries. Display "now" instead of "In -0.4 hours"
author | drewp@bigasterisk.com |
---|---|
date | Sat, 07 Sep 2024 17:47:36 -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> `; } }