13
|
1 import { css, html, LitElement } from "lit";
|
|
2 import { shared } from "./shared";
|
15
|
3 import { customElement } from "lit/decorators.js";
|
13
|
4
|
15
|
5 @customElement("fd-clock")
|
13
|
6 export class FdClock extends LitElement {
|
|
7 constructor() {
|
|
8 super();
|
|
9 setInterval(() => {
|
|
10 this.requestUpdate();
|
|
11 }, 1000);
|
|
12 }
|
|
13 static styles = [
|
|
14 shared,
|
|
15 css`
|
|
16 `,
|
|
17 ];
|
|
18 render() {
|
|
19 const t = new Date();
|
|
20 const h = t.getHours().toString().padStart(2, "0");
|
|
21 const m = t.getMinutes().toString().padStart(2, "0");
|
|
22 const s = t.getSeconds().toString().padStart(2, "0");
|
|
23 return html` <span class="t">${h}:${m.slice(0, 2)}:${s.slice(0, 2)}</span> `;
|
|
24 }
|
|
25 }
|