2019-04-11 17:14:34 +08:00
|
|
|
import ComboBoxComponent from "select-kit/components/combo-box";
|
2019-11-08 05:38:28 +08:00
|
|
|
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
2019-04-11 17:14:34 +08:00
|
|
|
|
|
|
|
export default ComboBoxComponent.extend({
|
|
|
|
pluginApiIdentifiers: ["timezone-input"],
|
|
|
|
classNames: "timezone-input",
|
|
|
|
allowAutoSelectFirst: false,
|
|
|
|
fullWidthOnMobile: true,
|
|
|
|
filterable: true,
|
|
|
|
allowAny: false,
|
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed
|
2019-04-11 17:14:34 +08: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
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|