IBM-Cloud / insurance-bot

A message based insurance experience
http://cloudco.mybluemix.net
Other
36 stars 57 forks source link

Ana does not consider user timezone when evaluating "today", "yesterday" #154

Closed l2fprod closed 7 years ago

l2fprod commented 7 years ago

the evaluation of today, yesterday occurs on the server in bot.js:

            var userDate = chrono.parseDate(date);

but this uses the server time as reference. Thus depending on the client timezone, it could give different results for Today. As example, use the bot early in the morning in France, put "Today", it may evaluate as the day before in France because of the time difference.

https://github.com/wanasit/chrono has https://github.com/wanasit/chrono#reference-date to solve this.