Enforce input of type date, enhancing UX for browser compatible.

Note: the submitted date format is iso8601 YYYY-MM-DD (as we expect), 
even if the displayed date by the browser depends of the user's browser 
locale. Theses browsers then safely ignore input placeholder.

This is why we can't display the expected date format elsewhere in the 
interface: these users will see another format as the one we expect, and 
we don't want to mislead them.
The date format is only displayed as a placeholder, for browser 
non-compatible with input of type date.
This commit is contained in:
Colin Darie 2018-08-29 17:17:58 +02:00
parent 279f384e56
commit 3cbf0e2656
No known key found for this signature in database
GPG Key ID: 4FB865FDBCA4BCC4
3 changed files with 4 additions and 9 deletions

View File

@ -20,14 +20,13 @@
<%= f.input :domain_expires_at,
required: true,
input_html: {
type: :string,
type: :date,
value: check.domain_expires_at&.to_date,
# min: Date.yesterday,
# max: 10.years.from_now.end_of_year.to_date
min: Date.yesterday,
max: 10.years.from_now.end_of_year.to_date
},
as: :string,
placeholder: t(".domain_expires_at_placeholder"),
hint: t(".domain_expires_at_hint")
placeholder: t(".domain_expires_at_placeholder")
%>
</div>

View File

@ -122,8 +122,6 @@ en:
unsupported: |
This top-level domain isn't currently automatically supported.
You'll have to fill and maintain yourself the expiry date.
domain_expires_at_hint: |
Fill the expiry date in YYYY-MM-DD format.
domain_expires_at_placeholder: YYYY-MM-DD.
ssl:
domain: Hostname

View File

@ -155,8 +155,6 @@ fr:
unsupported: |
Cette extension n'est pas supportée automatiquement actuellement.
Vous devrez saisir et maintenir vous-même sa date d'expiration.
domain_expires_at_hint: |
Renseignez la date d'expiration au format AAAA-MM-JJ.
domain_expires_at_placeholder: AAAA-MM-JJ
ssl:
domain: Nom d'hôte