Add local date object
This commit is contained in:
parent
5b04f9e0ae
commit
dada521fba
1 changed files with 14 additions and 0 deletions
14
javascript/LocalDate.js
Normal file
14
javascript/LocalDate.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
import element from 'https://cdn.jsdelivr.net/gh/darkwiiplayer/js@3724b3e/element.js'
|
||||
|
||||
element(class LocalDate extends HTMLTimeElement {
|
||||
static is = 'time'
|
||||
static attributes = { datetime: { get: date => new Date(date) } }
|
||||
|
||||
constructor() {
|
||||
super()
|
||||
}
|
||||
|
||||
datetimeChanged() {
|
||||
this.innerText = this.datetime.toDateString()
|
||||
}
|
||||
})
|
Loading…
Reference in a new issue