-
Notifications
You must be signed in to change notification settings - Fork 0
02 Web Components
Roberto Ferranti edited this page Mar 19, 2026
·
1 revision
class Instant extends ftl.ParsedElement {
#format = new Intl.DateTimeFormat('it-IT', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false
});
async render() {
const isoInstant = this.innerText.trim();
this.innerText = this.#format.format(new Date(isoInstant));
}
}ftl.registry
.defineElement("my-instant", Instant)
.configure();<body>
<my-instant>
2030-12-10T11:12:13.456
</my-instant>
</body>