diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-09-13 00:01:28 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-09-13 00:01:28 +0200 |
commit | a82b6c772089aa46e30c6c89ef48f514294df3cb (patch) | |
tree | e25d9b6fd1fefe8b6ac293a5c0b53293872a8f54 /static/components/date-jump.ts | |
parent | Add basic documentation for lens. (diff) | |
parent | Even more documentation. (diff) | |
download | calp-a82b6c772089aa46e30c6c89ef48f514294df3cb.tar.gz calp-a82b6c772089aa46e30c6c89ef48f514294df3cb.tar.xz |
Merge branch 'next' into datarewrite-structures
Diffstat (limited to '')
-rw-r--r-- | static/components/date-jump.ts | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/static/components/date-jump.ts b/static/components/date-jump.ts deleted file mode 100644 index fd3908ae..00000000 --- a/static/components/date-jump.ts +++ /dev/null @@ -1,40 +0,0 @@ -export { DateJump } - -/* Replace backend-driven [today] link with frontend, with one that - gets correctly set in the frontend. Similarly, update the go to - specific date button into a link which updates wheneven the date - form updates. -*/ -class DateJump extends HTMLElement { - - readonly golink: HTMLAnchorElement; - readonly input: HTMLInputElement; - - constructor() { - super(); - - this.golink = document.createElement('a') - this.golink.classList.add('btn'); - this.golink.textContent = "➔" - this.input = document.createElement('input') - this.input.type = 'date'; - } - - connectedCallback() { - - /* Form is just here so the css works out */ - let form = document.createElement('form'); - form.replaceChildren(this.input, this.golink); - this.replaceChildren(form); - - this.input.onchange = () => { - let date = this.input.valueAsDate!.format('~Y-~m-~d'); - this.golink.href = `${date}.html` - } - - let now = (new Date).format("~Y-~m-~d") - this.input.value = now; - /* onchange isn't triggered by manually setting the value */ - this.golink.href = `${now}.html` - } -} |