changeset 128:79abdecb2d0b

Add a regex for dates
author Benoît Allard <benoit.allard@greenbone.net>
date Thu, 23 Oct 2014 16:57:36 +0200
parents d49c1ee6bc07
children d2588d88d47a
files farol/templates/macros.j2
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/farol/templates/macros.j2	Thu Oct 23 16:50:02 2014 +0200
+++ b/farol/templates/macros.j2	Thu Oct 23 16:57:36 2014 +0200
@@ -42,7 +42,9 @@
      id="{{ name }}" name="{{ name }}"
      {%- if placeholder %} placeholder="{{ placeholder }}"{% endif %}
      {%- if value %} value="{{ value }}"{% endif %}
-     {%- if regex %} pattern="{{ regex }}"{% endif %}
+     {%- if regex %} pattern="{{ regex }}"
+     {%- elif type == "datetime" %} pattern="\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?([+-]\d+(:\d+)?|Z)?)?"
+     {%- endif %}
      {%- if required %} required{% endif %}
      {{- extras | xmlattr }}>
   {% if type == "datetime" %}

http://farol.wald.intevation.org