Dates: four-digit years from 1900 to 2100
Chromium's date input lets the year part take six digits when the input has no max, so typing 2026 and then 11 for the month gave 202611-12-05 (reported on the live app). Every date input now carries min="1900-01-01" and max="2100-12-31", so the year part stops at four digits and moves on to the month. Checked in Edge: typing 20261112 gives 2026-11-12, where it left the field empty before. The server checks the same years for every date field (dates::parse_form_date). Person, passport and address dates were only parsed, so a two-digit year such as 0026-11-12 would have been saved; stay records had the range already. A six-digit year never parsed, so no such date can be in the database. Tests: the parser's cases; the person, passport and arrival forms refuse both years and save nothing; every date input on every page carries the limits (pages.rs).
This commit is contained in:
1 parent
38070ee135
commit
d543c929e9
6 files changed
+147
-10
No files matched your search
@@ -4,7 +4,7 @@
|
||||
{% macro text(name, label, value="", err="", hint="", req=false, type="text", list="", auto="off", cls="", ph="") -%}
|
||||
<div class="field{% if err %} has-err{% endif %}{% if cls %} {{ cls }}{% endif %}">
|
||||
<label for="f-{{ name }}">{{ label }}{% if req %} <span class="req" aria-hidden="true">*</span>{% endif %}</label>
|
||||
<input id="f-{{ name }}" name="{{ name }}" type="{{ type }}" value="{{ value }}"{% if req %} required{% endif %}{% if list %} list="{{ list }}"{% endif %} autocomplete="{{ auto }}"{% if ph %} placeholder="{{ ph }}"{% endif %}{% if err %} aria-invalid="true" aria-describedby="e-{{ name }}"{% elif hint %} aria-describedby="h-{{ name }}"{% endif %}>
|
||||
<input id="f-{{ name }}" name="{{ name }}" type="{{ type }}" value="{{ value }}"{% if req %} required{% endif %}{% if list %} list="{{ list }}"{% endif %} autocomplete="{{ auto }}"{% if type == "date" %} min="1900-01-01" max="2100-12-31"{% endif %}{% if ph %} placeholder="{{ ph }}"{% endif %}{% if err %} aria-invalid="true" aria-describedby="e-{{ name }}"{% elif hint %} aria-describedby="h-{{ name }}"{% endif %}>
|
||||
{%- if hint %}
|
||||
<p class="hint" id="h-{{ name }}">{{ hint }}</p>
|
||||
{%- endif %}
|
||||
|
||||
Reference in new issue
Block a user