This is what happens:
The user is asked to enter their date of birth, identified with the variable [ $ date_bird ] to be extracted from the dialog with [ input.text ].
I need to verify that the date entered by the user is not greater or less than 18 years old.
Take a look at the IBM Watson Assistant supported expressions for date and time calculations .
Take the date of birth, add 18 years and check if it is before or after now.
You can use expressions in a condition on a node. However, I would probably evaluate the condition separately and set up a new context variable that indicates true / false on the "is over 18".
In the following example I have used this expression to decide on the age:
@sys-date.plusYears(18)<= today()
My test intent responds with old enough or too young , depending on the birthdate.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.