Wit-ai returns different date and time, if timezone specified
Hello Team,
I have set default timezone in wit-ai as "UTC".
If I say - "tomorrow 4pm"
wit returns as -
stdClass Object
(
[_text] => tomorrow 4pm
[entities] => stdClass Object
(
[datetime] => Array
(
[0] => stdClass Object
(
[confidence] => 0.9617875
[values] => Array
(
[0] => stdClass Object
(
[value] => 2019-02-09T16:00:00.000+00:00
[grain] => hour
[type] => value
)
)
[value] => 2019-02-09T16:00:00.000+00:00
[grain] => hour
[type] => value
)
)
)
[msg_id] => 1dYwr0tIvRLXcrV15
)
============================================ and if I say - "tomorrow 4pm pst"
wit returns as -
stdClass Object
(
[_text] => tomorrow 4pm pst
[entities] => stdClass Object
(
[datetime] => Array
(
[0] => stdClass Object
(
[confidence] => 0.96017333333333
[values] => Array
(
[0] => stdClass Object
(
[value] => 2019-02-09T00:00:00.000+00:00
[grain] => minute
[type] => value
)
)
[value] => 2019-02-09T00:00:00.000+00:00
[grain] => minute
[type] => value
)
)
)
[msg_id] => 15lpHscFt4Bp7YIZ7
)
================================================
My question is - how will I identify whether the user inputs along with timezone? cause I am getting the response in UTC.
My request is - Can you guys add another parameter as timezone kind of? so that we can understand that the input date time is converted from specified timezone.
Thanks.
Yes even i am facing the same kind of issue.
How can we resolve this issue. ?
Hi, Please do reply as i have to resolve this issue.
Hi @umasudheesh and @sushant0077, we'll relay this feature request to the engineers on Duckling, but it's low priority for us at the moment. You may find the docs on leveraging Context helpful (https://wit.ai/docs/http/20170307#context_link). You can also set the verbose flag to true and do some regex matching on the text body to identify the timezone.
Leaving this open as feature request --
Hey, to follow-up on this, can you share a bit more on the use cases where you need to know that there's been a timezone conversion? Thanks.
Hey, to follow-up on this, can you share a bit more on the use cases where you need to know that there's been a timezone conversion? Thanks.
Hello @patapizza ,
Thanks for your response.
You can also refer my above query with example.
I want to know the timezone in following cases -
Case 1: Only time mentioned If a user specifically mention the timezone in a statement as "call me at 2pm pst" or some other timezone as mst, est, ist , cst etc.
Case 2: Date and time mentioned Or if he says "schedule it on Monday 3 pm MST" or if he says "call me on 28th March 3pm pst"
Case 3: Test Case we did The wit doesn't convert it in specified time zone in this case "2pm in cst"
Thanks.
What I'm trying to understand is how you're going to use the timezone. Thanks!
What I'm trying to understand is how you're going to use the timezone. Thanks!
Ok. Got it.
Our Clients are from PST, MST, CST and EST timezone. Basically we have developed our project using these timezones. So whenever the user ask us to schedule an appointment at particular time we do schedule according to their timezone. As we know their present timezone. But we are facing the issue whenever they say datetime with timezone.
eg: "schedule it on 3/18/2019 3 pm MST" Response :
{
"_text": "schedule it on 3/18/2019 3 pm MST",
"entities": {
"datetime": [
{
"confidence": 1,
"values": [
{
"value": "2019-03-18T22:00:00.000+00:00",
"grain": "minute",
"type": "value"
}
],
"value": "2019-03-18T22:00:00.000+00:00",
"grain": "minute",
"type": "value"
}
]
},
"msg_id": "17a3VIiDvZVuAF7kG"
}
Cause wit convert that datetime into specified timezone and reproduce with UTC. And what actually we do is convert the wit response datetime i.e in UTC to the client's timezone.
Here we are facing the issue. We scheduling them with wrong date time.
I hope this much detail enough for your enhancement.
If required more, let me know.
Thanks.
What I'm trying to understand is how you're going to use the timezone. Thanks!
If you add another parameter as timezone kind of, whenever there is a datetime conversion then we will get to know that the specified date time is converted one. Then we can schedule them as it is.
Hi @umasudheesh,
As you know your client timezone, I suggest to pass it directly in the request, and use the returned values as is (i.e. not do any conversion afterwards). If the passed timezone is also present in the text, it will essentially be a no-op.
Hope this helps, Julien