repocrypts / Validator

Client-side javascript validator library ports from Laravel 5.2
MIT License
46 stars 22 forks source link

Date rule is implicitly required #15

Closed ferrao closed 4 years ago

ferrao commented 5 years ago

The following code should validate and not print any errors:

let v = Validator.make({}, { date: 'date' });
if (v.fails()) {
    let errors = v.getErrors()
    console.log(errors)
}

But the following ouput is produced:

{ date: [ 'The date is not a valid date.' ] }

Robinz250 commented 4 years ago

Not only with dates, but with any other type of data

`const rules = { data : 'alpha' } const validatorTest = Validator.make({}, rules)

if(validatorTest.fails()){ console.log(validatorTest.getErrors()); }`

The output produced is:

{ data: [ 'The data may only contain letters.' ] }

jfstn commented 4 years ago

@Robinz250 you are free to open a PR to solve the issue.