Keep generated test URLs readable

This commit is contained in:
mikecarper
2026-09-16 17:27:18 -07:00
parent e91e439283
commit ad0ea545d3
4 changed files with 29 additions and 13 deletions
+19 -9
View File
@@ -449,17 +449,27 @@
}).format(new Date(milliseconds));
}
function readableQueryValue(value) {
return encodeURIComponent(String(value))
.replace(/%3A/gi, ":")
.replace(/%2F/gi, "/");
}
function configuredUrl(config, baseUrl) {
const url = new URL(baseUrl);
url.search = "";
url.searchParams.set("start", new Date(config.startMs).toISOString());
url.searchParams.set("end", new Date(config.endMs).toISOString());
url.searchParams.set("tz", config.tz);
url.searchParams.set("freq", config.freqText);
url.searchParams.set("bw", config.bwText);
url.searchParams.set("sf", String(config.sf));
url.searchParams.set("cr", String(config.cr));
url.searchParams.set("tx", config.txText);
const values = [
["start", new Date(config.startMs).toISOString()],
["end", new Date(config.endMs).toISOString()],
["tz", config.tz],
["freq", config.freqText],
["bw", config.bwText],
["sf", String(config.sf)],
["cr", String(config.cr)],
["tx", config.txText],
];
url.search = "?" + values.map(function (entry) {
return entry[0] + "=" + readableQueryValue(entry[1]);
}).join("&");
return url.toString();
}
+3 -3
View File
@@ -266,9 +266,9 @@ clock</code></pre>
<div class="preset-test-generator-disclosure-body">
<p>
Enter the test times in the selected time zone and choose the radio
tuple. The generated URL converts the times to exact UTC instants and
keeps <code>tz</code> so the page displays them in the organizer's local
time zone.
tuple. The generated URL converts the times to exact UTC instants, keeps
the date punctuation readable, and keeps <code>tz</code> so the page
displays them in the organizer's local time zone.
</p>
<div class="preset-test-generator-layout">