当用户输入时间时,如何将履行发送到我在对话流中使用的时区?
How to send the fulfillment the timezone I use in dialogflow when user enters time?
如果我的意图是等待用户时间,
当他输入 11:33AM 时如何获取用户的时区?
如果不明确要求用户提供与其时区相关的信息,就无法获取用户的时区。您可以直接询问他们的时区,或者询问他们的位置,然后使用 fulfillment 确定他们的时区。
当用户在聊天中输入时间时,您将获得完整日期 window。
所以在你的后端你可以获得时区偏移量。
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
如果我的意图是等待用户时间, 当他输入 11:33AM 时如何获取用户的时区?
如果不明确要求用户提供与其时区相关的信息,就无法获取用户的时区。您可以直接询问他们的时区,或者询问他们的位置,然后使用 fulfillment 确定他们的时区。
当用户在聊天中输入时间时,您将获得完整日期 window。
所以在你的后端你可以获得时区偏移量。
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