Closed smiley05 closed 6 years ago
First, please format your message properly. It's hard to understand.
Also have you considered the docs? https://indicative.adonisjs.com/docs/api/extend
Well thank you for your response. Yes, I followed the docs and tried the same example indicative.time=timeFn, but when I set time in the rules setting as shown, I am getting "time is not defined as a validation rule" error. rules = { time: 'required | time' }
Can you point me to the docs which say that you can define rules on the indicative
object?
I mean from this docs sample only - https://indicative.adonisjs.com/docs/api/extend
As per the docs you have to use the validations
object and not indicative
const { validations } = require('indicative')
validations.time = timeFn
oh yes!!! I didn't understood before, now I got it. Thank you.
Hi, Thank you for your great work and support.
When I tried the sample as shown per the docs Iam getting "time is not defined as a validation rule". Please help the following is the sample I tried. Please correct whats wrong? var indicative = require('indicative'); const timeRegex = /([01]?[0-9]|2[0-3]):[0-5]0-9?/
const timeFn = function (data, field, message, args, get) { return new Promise((resolve, reject) => { const fieldValue = get(data, field)
}) } indicative.time = timeFn; rules = { first_name: 'required', last_name: 'required', time: 'required|time' }