diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-10-01 11:49:26 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-10-01 11:49:26 +0200 |
commit | 98a56b782d1ced056c77019e88b4bcea4a270f83 (patch) | |
tree | ccfb714dc111c7437f2cdf52b956d95d954ad4df /static/lib.js | |
parent | Remove old date_time system. (diff) | |
download | calp-98a56b782d1ced056c77019e88b4bcea4a270f83.tar.gz calp-98a56b782d1ced056c77019e88b4bcea4a270f83.tar.xz |
Reintroduce dateonly for date-time-input:s.
Diffstat (limited to 'static/lib.js')
-rw-r--r-- | static/lib.js | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/static/lib.js b/static/lib.js index 1d42100c..100f4161 100644 --- a/static/lib.js +++ b/static/lib.js @@ -129,6 +129,24 @@ function asList(thing) { } +function boolean (value) { + switch (typeof value) { + case 'string': + switch (value) { + case 'true': return true; + case 'false': return false; + case '': return false; + default: return true; + } + case 'boolean': + return value; + default: + return !! value; + } +} + + + /* internal */ function datepad(thing, width=2) { return (thing + "").padStart(width, "0"); @@ -159,7 +177,8 @@ function format_date(date, str) { } return outstr; } -Object.prototype.format = function () { return "" + this; } /* any number of arguments */ + +Object.prototype.format = function (/* any number of arguments */) { return "" + this; } Date.prototype.format = function (str) { return format_date (this, str); } /* @@ -176,4 +195,11 @@ DOMTokenList.prototype.find = function (regexp) { } } +/* HTMLCollection is the result of a querySelectorAll */ +HTMLCollection.prototype.forEach = function (proc) { + for (let el of this) { + proc(el); + } +} + const xcal = "urn:ietf:params:xml:ns:icalendar-2.0"; |