0

If my intent waits for users time, how can I get user's timezone when he enters 11:33AM?

Sairaj Sawant
  • 1,842
  • 1
  • 12
  • 16
SteveS
  • 3,789
  • 5
  • 30
  • 64

2 Answers2

1

You will get full date when user enters time from chat window.

So in your backend you can get timezone offset.

const D = new Date('Date/time coming from dialogflow')
var offset = D.getTimezoneOffset();
console.log(offset);

The time-zone offset is the difference, in minutes, between UTC and local time. Note that this means that the offset is positive if the local timezone is behind UTC and negative if it is ahead. For example, if your time zone is UTC+10 (Australian Eastern Standard Time), -600 will be returned. Daylight savings time prevents this value from being a constant even for a given locale

Nikhil Savaliya
  • 2,138
  • 4
  • 24
  • 45
0

There isn't a way to get the user's timezone without explicitly asking them for information relating to their timezone. You could directly ask them for their timezone, or ask for their location and then determine their timezone using fulfillment.

fishcakes
  • 528
  • 6
  • 12