Shorthand Summary: What is the best way / best practice to take in a Timezone purely via text-based user input? Am I attempting a very sticky task?
Background is: I'm working on a nodejs chatbot that is meant to be able to help schedule events for a group that is mostly based in North America, but has participants from around the globe as well. I am able to listen to various user input and respond accordingly. However, other than the user name, the API available to me does not return anything else.
My command input is planned to look like the following:
!Event datetime="MM-DD-YYYY h:mm a" timezone="PST" name="Foobar"
Through moment I am able to parse a moment with the datetime. However, I am failing on applying the timezone. My clients are generally unfamiliar with the UTC/GMT system. Most of them are based in NA or EU, and are more used to abbreviations. I want to make this as user friendly as possible, but how would I map their timezone input to a tz database style for use within the code? I could redirect them to the wiki page regarding the tz database and all the various cities, but it's quite a large list that isn't very user friendly to the average joe.
I am experimenting with moment-timezone, and the closest thing I have is basically a mapping table of UTC offsets to a description + a tz database name. Something like:
var TIMEZONE_MAPPINGS = {
"UTC+9" : "Asia/Tokyo",
...
"UTC-8" : "America/Los_Angeles",
}
But I feel this is very hackish, and not really good for DST either while I am selecting a "well known" item for each offset.
Is there a better way to take in input like this? Or should I just give up and take in everything via UTC and have an explanation on what UTC is?