summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorstuebinm2021-04-12 18:07:41 +0200
committerstuebinm2021-04-12 18:07:41 +0200
commit5596ebcbad7721f767972c3143f8e5be1ba8fc09 (patch)
tree4f792eaf042e6d8236690588b4bf59641463002c /utils
parent6b892239f80e8523e02d7348e5483e9a7aea58ee (diff)
add date answer space
for now, this is just a simple date picker done via the html input type "date". Unfortunately, that's not supported by Safari, so the rust util now prints out a warning if it's used. I'm not sure if there's any other reasonable option which would go around this that's not "using a web framework" or "hacking a fallback date picker which just consists of a couple of combo boxes".
Diffstat (limited to '')
-rw-r--r--utils/src/main.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/utils/src/main.rs b/utils/src/main.rs
index 4428ac3..cafb4f9 100644
--- a/utils/src/main.rs
+++ b/utils/src/main.rs
@@ -34,12 +34,13 @@ struct Question {
space: AnswerSpace,
}
-#[derive(Deserialize, Serialize, StaticType, Debug)]
+#[derive(Deserialize, Serialize, StaticType, Debug, PartialEq)]
enum AnswerSpace {
Single(Vec<String>),
Multiple(Vec<String>),
YesOrNo,
Freeform(String),
+ Date,
}
#[derive(StructOpt, Debug)]
@@ -79,6 +80,11 @@ fn main () {
std::process::exit(1);
},
Ok(data) => {
+ if data.questions.iter().any(|q| q.space == AnswerSpace::Date) {
+ eprintln!(">> Warning: html input type date is not supported by Safari and Internet Explorer.\n See https://caniuse.com/input-datetime for details.");
+ }
+
+
let json = json::to_string(&data).unwrap();
// if a public key is given to encrypt the survey, ad-hoc typecheck it