Closed begueradj closed 5 years ago
Hey @begueradj! 👋
This rule is well tested: https://github.com/poppinss/indicative/blob/develop/test/node/validations.spec.js#L421
If you believe there's a bug, could you please create a test case that fail?
There is at least this test that covers this case. However the demo I shared shows there is a problem with dateFormat()
. Actually this was asked as a question on the forum, this means an other user stumbled on the exact same issue
The Limitations section in the docs says:
Since the validation rules are defined using a string based expression, it has certain limitations. You cannot use reserved keywords like
:
or a|
, within arguments.
So you should rewrite your code as
const {rule} = use('Validator')
//...
get rules() {
return {
name: 'required',
effective_datetime: [
rule('required'),
rule('date'),
rule('dateFormat', 'YYYY-MM-DD HH:mm:ss')
]
}
}
I read that section but I guess I did not take it seriously. I did not try your solution but I believe it will work. Thank you very much for the feedback. I will try it ASAP. @webNeat
Problem
dateFormat:'YYYY-MM-DD HH:mm:ss'
never gets validated unless I removeHH:mm:ss
or keep only:YYYY-MM-DD HH
.The exact error message I see in the console:
Sample code
Package version
Current
Node.js and npm version
npm: 6.9.0 Node.js: 11.8.0 AdonisJs: 4.1.0
BONUS (a sample repo to reproduce the issue)
Link