aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2019-11-28 15:59:07 +0000
committerDave Arter <davea@mysociety.org>2019-12-09 12:50:07 +0000
commit997121e1987fc596b0bbdf89bcb23776e2a4bb9a (patch)
treebf9c6a028ae7d83d9a171215a777c7cbf193d71f
parent27ab4708037b207234bb0e942a538c044c972adf (diff)
[TfL] Add time validator & help for invalid dates
-rw-r--r--web/cobrands/tfl/js.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/web/cobrands/tfl/js.js b/web/cobrands/tfl/js.js
index c80036370..a217d3984 100644
--- a/web/cobrands/tfl/js.js
+++ b/web/cobrands/tfl/js.js
@@ -2,6 +2,14 @@
translation_strings.name.validName = 'Please enter your full name, Transport for London needs this information – if you do not wish your name to be shown on the site, untick the box below';
translation_strings.upload_default_message = 'Drag photo here to upload or <u>browse files</u>';
+translation_strings.incident_date = { date: 'Enter a date in the format dd/mm/yyyy' };
+translation_strings.time = 'Enter a time in the format hh:mm';
+
+if (jQuery.validator) {
+ jQuery.validator.addMethod('time', function(value, element) {
+ return this.optional(element) || /^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/.test( value );
+ }, translation_strings.time );
+}
fixmystreet.tfl_link_update = function() {
var lat = document.getElementById('fixmystreet.latitude');