Reputation: 195
I am trying to train a Dialogflow bot to recognize different travel requests (flight reservations, hotel bookings, etc). I see that it doesn't properly parse the time if it isn't specified as a 12-hour format (with AM/PM).
I need a flight from London to Paris Saturday between 08:00 and 10:00 is parsed as 2019-03-09T20:00:00Z/2019-03-09T22:00:00Z
Instead, if I write 08:00 AM and 10:00 AM, then it is parsed well. I am using the default entity @sys.date-time. Is there any way to make it interpret the times correctly also as 24-hour format (08:00 to be recognized as 8AM and not 8PM)?
Upvotes: 6
Views: 2842
Reputation: 81
The only option to have it parsed correctly I found so far is to add additional word programmatically to the initiating request (like "8:00 morning"). It works for me but indeed it is an ugly bug.
Upvotes: 2
Reputation: 53
It's not a proper solution but maybe this information will help you. If the time is inserted without am/pm, dialogflow will take the current time as reference. For example, if you ask this before 12:00:
I need a flight from London to Paris Saturday between 08:00 and 10:00
Dialogflow detects: 2019-03-09T08:00:00Z/2019-03-09T10:00:00Z.
But if you ask after 12:00 Dialogflow detects: 2019-03-09T20:00:00Z/2019-03-09T22:00:00Z
Upvotes: 1
Reputation: 529
Yes you can choose a different system entity such as @sys.time for that particular time variable but also make sure that you have set up training phrases in that intent as well. You can read more about the system entities in the Dialogflow documentation.
Example: @sys.time will parse 4:30pm as "16:30:00"
Upvotes: 0