Handling Date in action - Rasa Open Source - Rasa Community Forum
👋 Introducing the Rasa Playground
Handling Date in action
post by manoj_kumar on Nov 25, 2020
async def validate_time(
self,
value: Text,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any],
) -> Dict[Text, Any]:
"""Validates value of 'time' slot"""
timeentity = get_entity_details(tracker, "time")
parsedtime = timeentity and parse_duckling_time(timeentity)
if not parsedtime:
dispatcher.utter_message(template="utter_no_transactdate")
return {"time": None}
return parsedtime
Can I apply a logic to it that “if date is less than today” should throw an error that invalid date or time Can any one help out on this
Thanks in advance.
post by jjuzl on Dec 2, 2020
Hi @manoj_kumar,
You can use any python code to validate the slot value and then use dispatcher.utter_message like in your example to send a message to the user.
post by manoj_kumar on Dec 2, 2020
Hi @jjuzl,
Thanks for the reply.
And I tried applying a logic that if the date is less than today and gave dispatcher.utter_message(“Invalid Date”). But, it was taking any date and scheduling the payment
Screenshot (196)](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/0/0b8e17429630ec4293abbdcec6c2c54f7247c539.png "Screenshot (196)")
https://github.com/RasaHQ/financial-demo/tree/rasa-2-0 Could you explain me the process step-by-step please?
Thanks