2019-04-11 05:14:34 -04:00
|
|
|
import ComboBoxComponent from "select-kit/components/combo-box";
|
2020-01-16 12:56:53 -05:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
2019-04-11 05:14:34 -04:00
|
|
|
|
|
|
|
export default ComboBoxComponent.extend({
|
|
|
|
pluginApiIdentifiers: ["timezone-input"],
|
|
|
|
classNames: "timezone-input",
|
|
|
|
allowAutoSelectFirst: false,
|
|
|
|
fullWidthOnMobile: true,
|
|
|
|
filterable: true,
|
|
|
|
allowAny: false,
|
|
|
|
|
2019-11-07 16:38:28 -05:00
|
|
|
@discourseComputed
|
2019-04-11 05:14:34 -04:00
|
|
|
content() {
|
|
|
|
let timezones;
|
|
|
|
|
|
|
|
if (
|
|
|
|
moment.locale() !== "en" &&
|
|
|
|
typeof moment.tz.localizedNames === "function"
|
|
|
|
) {
|
|
|
|
timezones = moment.tz.localizedNames();
|
|
|
|
}
|
|
|
|
timezones = moment.tz.names();
|
|
|
|
|
|
|
|
return timezones.map(t => {
|
|
|
|
return {
|
|
|
|
id: t,
|
|
|
|
name: t
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|