2024-08-23 19:17:07 +08:00
|
|
|
import { classNames } from "@ember-decorators/component";
|
2019-04-11 17:14:34 +08:00
|
|
|
import ComboBoxComponent from "select-kit/components/combo-box";
|
2024-08-23 19:17:07 +08:00
|
|
|
import {
|
|
|
|
pluginApiIdentifiers,
|
|
|
|
selectKitOptions,
|
|
|
|
} from "select-kit/components/select-kit";
|
2019-04-11 17:14:34 +08:00
|
|
|
|
2024-08-23 19:17:07 +08:00
|
|
|
@classNames("timezone-input")
|
|
|
|
@selectKitOptions({
|
|
|
|
filterable: true,
|
|
|
|
allowAny: false,
|
|
|
|
})
|
|
|
|
@pluginApiIdentifiers("timezone-input")
|
|
|
|
export default class TimezoneInput extends ComboBoxComponent {
|
2022-02-03 06:41:42 +08:00
|
|
|
get nameProperty() {
|
|
|
|
return this.isLocalized ? "name" : null;
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2022-02-03 06:41:42 +08:00
|
|
|
|
|
|
|
get valueProperty() {
|
|
|
|
return this.isLocalized ? "value" : null;
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2022-02-03 06:41:42 +08:00
|
|
|
|
|
|
|
get content() {
|
|
|
|
return this.isLocalized ? moment.tz.localizedNames() : moment.tz.names();
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2022-02-03 06:41:42 +08:00
|
|
|
|
|
|
|
get isLocalized() {
|
|
|
|
return (
|
|
|
|
moment.locale() !== "en" && typeof moment.tz.localizedNames === "function"
|
|
|
|
);
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
|
|
|
}
|