summaryrefslogtreecommitdiff
path: root/site/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'site/index.html')
-rw-r--r--site/index.html28
1 files changed, 28 insertions, 0 deletions
diff --git a/site/index.html b/site/index.html
index 6141163..1555a21 100644
--- a/site/index.html
+++ b/site/index.html
@@ -125,6 +125,32 @@
];
}
+ function mkDatePicker (name) {
+ let [input, label] = mkOption("date", name);
+ let errormsg = setErrormsg(
+ mkElement("div","","error"),
+ null
+ );
+ let div = appendChildren (
+ mkElement("div"),
+ [label,
+ mkElement("span", " "),
+ input,
+ errormsg]
+ );
+ return [
+ div,
+ () => {
+ let date = input.valueAsDate;
+ let [ret, error] = date !== null && !isNaN(date.valueOf())
+ ? [date.toISOString(), null]
+ : [null, _("Please pick a date")]
+ setErrormsg (errormsg, error);
+ return ret;
+ }
+ ]
+ }
+
// essentially a case - of statement over the answerspace type.
// since there is no validation of the config json, it may turn
// out to be a partial function in practice.
@@ -132,6 +158,8 @@
let space = question.space;
if (space === "YesOrNo") {
return mkListSpace("radio", ["yes", "no"], question.name, question.question);
+ } if (space === "Date") {
+ return mkDatePicker(question.name);
} if ("Single" in space) {
return mkListSpace("radio", space.Single, question.name, question.question);
} if ("Multiple" in space) {