aboutsummaryrefslogtreecommitdiffstats
path: root/hesla.ts
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2023-01-22 14:06:25 +0100
committerMatěj Cepl <mcepl@cepl.eu>2023-01-22 14:32:17 +0100
commitb01e1e4c3907cea472284c3142a9860bb2992593 (patch)
tree234b27b5f902377753ded46f051bdd066c50c84d /hesla.ts
parent9e8931a65545595fea87132e77e70005556997d1 (diff)
downloadhesla-b01e1e4c3907cea472284c3142a9860bb2992593.tar.gz
Compiles cleanly
Diffstat (limited to 'hesla.ts')
-rw-r--r--hesla.ts26
1 files changed, 9 insertions, 17 deletions
diff --git a/hesla.ts b/hesla.ts
index c9eeac3..05e7f2f 100644
--- a/hesla.ts
+++ b/hesla.ts
@@ -1,20 +1,12 @@
-/// <reference path='touchEvent.d.ts' />
-
import {ActivePage} from "activePage";
-class ISODate extends Date {
- constructor(dateStr?:string) {
- super(dateStr);
+function toISODateString(date) {
+ function pad(n) {
+ return n < 10 ? '0' + n : n;
}
- public toISODateString() {
- function pad(n) {
- return n < 10 ? '0' + n : n;
- }
-
- return this.getFullYear() + '-' + pad(this.getMonth() + 1) +
- '-' + pad(this.getDate());
- }
+ return date.getFullYear() + '-' + pad(date.getMonth() + 1) +
+ '-' + pad(date.getDate());
}
export class Hesla extends ActivePage {
@@ -79,7 +71,7 @@ export class Hesla extends ActivePage {
get cur_watchword() {
console.log(`this.cur_section = ${this.cur_section}`);
if (!this.cur_section) {
- this.cur_section = new ISODate();
+ this.cur_section = new Date();
}
return this.cur_section;
@@ -104,8 +96,8 @@ export class Hesla extends ActivePage {
display() {
super.display();
- console.log("cur_watchword = " + this.cur_watchword.toISODateString());
- document.getElementById(this.cur_watchword.toISODateString()).
+ console.log("cur_watchword = " + toISODateString(this.cur_watchword));
+ document.getElementById(toISODateString(this.cur_watchword)).
classList.add("visible");
window.scroll(0, 0);
@@ -113,7 +105,7 @@ export class Hesla extends ActivePage {
today() {
console.log("jump to today!");
- this.cur_watchword = new ISODate();
+ this.cur_watchword = new Date();
this.display();
}