Skills and VA
Typescript
When we send messages from different timezones the localTimezone is overwritten every time with the Local Server Timezone and we lose the User's Timezone.
Try to send a message from a client in a Timezone and receive the message from a different timezone of the client.
At least to have in the context the user timezone
This happens in the BotFrameworkAdapter
, during the processActivity
method and the parseRequest
function.
if (typeof activity.localTimestamp === 'string') { activity.localTimestamp = new Date(activity.localTimestamp); }
Hi @tommyJimmy87! Thanks for reporting the issue!
We reproduced the issue and we would like to validate with you the repro steps that we followed to accomplish this. Also, we will continue reproducing the issue using a C# bot in order to compare the implementations and find the next steps to solve the issue.
Using the TypeScript Virtual Assistant Sample
npm install
npm run build
pwsh.exe -File deployment\scripts\deploy.ps1 -name "<BOT_NAME>" -location "<LOCATION>" -appId "<APP_ID>" -appPassword "<APP_PASSWORD>" -luisAuthoringKey "<LUIS_AUTHORING_KEY>" -luisAuthoringRegion "<LUIS_AUTHORING_REGION>"
Open the Bot Framework Emulator and configure it to connect the Virtual Assistant running locally
Set a breakpoint in the line 1004 of botFrameworkAdapter.ts inside of Botbuilder library
Change the System Time zone
to a different one (e.g. UTC+03:00 Minsk)
Debug the Virtual Assistant
The execution will stop at the breakpoint. The activity.localTimestamp
will show the datetime with the previous Local Server Timezone
After the assignment, the new datetime of activity.localTimestamp
will have the new User's Timezone
Thanks :relaxed:
Hi @VictorGrycuk ! Thanks for the fast answer first of all!
I don't know if I understood very well the steps, but I'll try to explain myself better with all the steps we did to reproduce the issue:
First assumption is that we have the Virtual Assistant deployed locally.
Second assumption is that we want to perform the test with 2 different laptops, where the first laptop is the client (for us is Teams) and the second laptop is the server where we are running the VA.
Third assumption is that we have 2 different Timezone set up on the 2 laptops, let's say the first one (client) will have GMT+0300
and the server will have GMT+0100
.
Then after we have everything set up we try from the client to send a request to the VA through Teams.
As soon as we get the request we have as parameter in the body the right timezone from the user :
Hey @tommyJimmy87! Thanks for the detailed steps! We will be reviewing this scenario and we will back to you later 😊.
Hi @tommyJimmy87!
We reached the conclusion that this is due to a limitation on how JavaScript handles the Date
object.
However, we want to let you know that we opened the issue #1612 about this issue on the BotBuilder-JS repository. You may track the progress of this issue there, so check there as well.
As for the problem we found, when converting any date to Date
object, JS converts it to UTC which essentially strips the original time zone. The only time zone that JavaScript can handle is the time zone of the system running JS.
You can check the Date documentation for information.
We will let you know any progress :relaxed:
Most helpful comment
Hi @tommyJimmy87! Thanks for reporting the issue!
We reproduced the issue and we would like to validate with you the repro steps that we followed to accomplish this. Also, we will continue reproducing the issue using a C# bot in order to compare the implementations and find the next steps to solve the issue.
Repro Steps
Using the TypeScript Virtual Assistant Sample
npm install
npm run build
Open the Bot Framework Emulator and configure it to connect the Virtual Assistant running locally
Set a breakpoint in the line 1004 of botFrameworkAdapter.ts inside of Botbuilder library
Change the
System Time zone
to a different one (e.g. UTC+03:00 Minsk)Debug the Virtual Assistant
The execution will stop at the breakpoint. The
activity.localTimestamp
will show the datetime with the previous Local Server TimezoneAfter the assignment, the new datetime of
activity.localTimestamp
will have the new User's TimezoneThanks :relaxed: