aboutsummaryrefslogtreecommitdiff
path: root/static/lib.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/lib.js')
-rw-r--r--static/lib.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/static/lib.js b/static/lib.js
index ab279353..1d42100c 100644
--- a/static/lib.js
+++ b/static/lib.js
@@ -32,6 +32,9 @@ function zip(...args) {
NOTE that only the raw `get' (and NOT the `getUTC') methods
should be used on these objects, and that the reported timezone
is quite often wrong.
+
+ TODO The years between 0 and 100 (inclusive) gives dates in the twentieth
+ century, due to how javascript works (...).
*/
function parseDate(str) {
@@ -117,7 +120,16 @@ function setVar(str, val) {
}
+function asList(thing) {
+ if (thing instanceof Array) {
+ return thing;
+ } else {
+ return [thing];
+ }
+}
+
+/* internal */
function datepad(thing, width=2) {
return (thing + "").padStart(width, "0");
}
@@ -147,7 +159,7 @@ function format_date(date, str) {
}
return outstr;
}
-Object.prototype.format = function () { return this; } /* any number of arguments */
+Object.prototype.format = function () { return "" + this; } /* any number of arguments */
Date.prototype.format = function (str) { return format_date (this, str); }
/*