How to handle date input from user?

Hello, I am using duckling dimension time for saving dates. My intent looks like below:


- intent: inform
  examples: |
    - I want to book a meeting on [3 Oct 2021](time)

which gets saved in slot time as : [‘3 oct 2021’, ‘2021-10-03T00:00:00.000-07:00’]. Then I am using below function to check if the date is greater than today or not.

def validate_time(
        self, 
        value: Any, 
        dispatcher: CollectingDispatcher, 
        tracker: Tracker, 
        domain: DomainDict,
    ) -> Dict[Text, Any]:
        value = tracker.get_slot("time")
        
        today = datetime.now()
        today = pytz.utc.localize(today)

        if str(value) < str(today):
            dispatcher.utter_message(text=f"Please select future date.")
            return{"time" : None}

        return {"time":value}

When I then try to display confirmation message to user that meeting is booked, it comes like this:

Your meeting room has been booked on [‘3 oct 2021’, ‘2021-10-03T00:00:00.000-07:00’] for 1pm to 3pm.

Why I am getting the date in list format?

Well, just do return {"time": value[0])} then

hey @ChrisRahme , no luck…!! I have entered something like :I need a meeting room on 29sep 2021
and time shows up like this-> time: ['29sep 2021', '2021-09-29T00:00:00.000-07:00'] And when I just enter the time into slot, it shows as time: 2021-10-03T00:00:00.000-07:00 ,which is right.

Show me the code that outputs this please

entities:
- time
slots:
  time:
    type: rasa.shared.core.slots.UnfeaturizedSlot
    initial_value: null
    auto_fill: true
    influence_conversation: false
- intent: inform_meet
  examples: |
    - I want to book a meeting room on [3 oct 2021](time)
class ValidateMeetingForm(FormValidationAction):
    def name(self) -> Text:
        return "validate_meeting_form"

    def validate_time(
        self, 
        value: Any, 
        dispatcher: CollectingDispatcher, 
        tracker: Tracker, 
        domain: DomainDict,
    ) -> Dict[Text, Any]:
        value = tracker.get_slot("time")
        
        today = datetime.now()
        today = pytz.utc.localize(today)

        if str(value) < str(today):
            dispatcher.utter_message(text=f"Please select future date.")
            return{"time" : None}

        return {"time":value[0]}

I asked for this please, I don’t see this anywhere

Hey @chri, it is now behaving some odd. Case I: When input is- I need an appointment on 3 Oct 2021Case I.zip (956.5 KB) Case II: When explicitly input for date is 3 Oct 2021