Skip to content

Commit

Permalink
feat: date format validator message
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanvier committed Nov 19, 2024
1 parent 03cd259 commit f013956
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@wgr-sa/nuxt-form",
"description": "Form builder for Nuxt",
"version": "0.9.3",
"version": "0.9.4",
"repository": "https://github.com/WGR-SA/nuxt-form.git",
"author": "jeanvier",
"license": "MIT",
Expand Down
3 changes: 3 additions & 0 deletions src/runtime/utils/validators/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export class FormValidator {
rule.$message = messages.get(rule.$params.type, 'validators') ?? rule.$message

if (rule.$params.options) {
if (['minDate', 'maxDate'].includes(rule.$params.type)) {
rule.$params.options[0] = new Date().toLocaleString('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute: '2-digit' }).replace(',', '')
}
Object.keys(rule.$params.options).map((param) => rule.$message = rule.$message.replace(`{${param}}`, rule.$params.options[param]))
}
})
Expand Down

0 comments on commit f013956

Please sign in to comment.