0

I have a azure botframework chatbot running in MS Teams. I got a scenario to show adpative card to user and ask for Date, Start Time and End Time. I'm using Input.Date and Input.Time pickers.

Issue is, in sql server we have UTC timezone. But in adaptive card, users might choose time based on their timezone. Is there any way I could convert this selected time to UTC timezone ?

I mean, if they choose Start Time as 8AM and End Time as 10AM (IST), I should get 2.30 AM - 4.30AM (UTC).

Below is the context.activity object

{"text":"book ticket","textFormat":"plain","type":"message","timestamp":"2022-05-17T07:20:18.165Z","localTimestamp":"2022-05-17T07:20:18.165Z","dfFBCQ","name":"User A","aadObjectId":"6f0b02-7e1d-4876-9278-0991e8fa763b"},"conversation":{"conversationType":"personal","tenantId":"aee6-xxx-xxx739ff24f","name":"teams-bot"},"entities":[{"locale":"en-US","country":"US","platform":"Web","timezone":"Asia/Calcutta","type":"clientInfo"}],"channelData":8.1659492+05:30","callerId":"urn:botframework:azure"}

Please let me know if any informations required.

Vinoth
  • 37
  • 1
  • 5
  • Could you please provide your code snippet on how you ask the user for the date? Also, have you had a chance to look at this solution? https://stackoverflow.com/questions/69179235/datetime-conversion-to-utc-from-selected-timezone#:~:text=Add%20a%20comment-,0,The%20following%20describes%20the%20Date%20constructor,-. – Ram Fattah May 17 '22 at 20:57
  • i had a look at that solution, but that doesn't help me. In Teams chatbot, Im display adaptive card to get start time and end time [code link](https://i.imgur.com/BNQ073H.png). Once user has click submit on adaptive card, I will get the response as {StartTime: "14:00", EndTime: "15:00"} along with this I also get context.activity which contains {"text":"book ticket", "timestamp":"2022-05-17T07:20:18.165Z","localTimestamp":"2022-05-17T07:20:18.165Z","name":"teams-bot"},"entities":[{"locale":"en-US","country":"US","platform":"Web","timezone":"Asia/Calcutta"}}. I want 14.00 in UTC based. – Vinoth May 18 '22 at 08:34
  • Could you please provide code snippet information, so that it will be helpful to look in to the solution. A sample code block will be posted in the answer section and check it to repro. – Sairam Tadepalli May 18 '22 at 09:01
  • i dont' have any code snippet yet. Currently I'm thinking of the solution. In Teams channel, lets say I post some adaptive card and prompt user to choose time like this [adaptive card](https://i.imgur.com/POZ2Ovs.png). In botframework nodejs, this.onMessage event will be triggered when user clicks submit. Sample payload will be looking like this {"text":"book ticket", "timestamp":"2022-05-17T07:20:18.165Z","localTimestamp":"2022-05-17T07:20:18.165Z","name":"teams-bot"},"entities":[{"locale":"en-US","country":"US","platform":"Web","timezone":"Asia/Calcutta"}} – Vinoth May 18 '22 at 10:14

0 Answers0