debian-mirror-gitlab/app/assets/javascripts/pages/profiles/init_timezone_dropdown.js
2023-01-12 18:35:48 +00:00

34 lines
737 B
JavaScript

import Vue from 'vue';
import TimezoneDropdown from '~/vue_shared/components/timezone_dropdown/timezone_dropdown.vue';
export const initTimezoneDropdown = () => {
const el = document.querySelector('.js-timezone-dropdown');
if (!el) {
return null;
}
const { timezoneData, initialValue, name } = el.dataset;
const timezones = JSON.parse(timezoneData);
const timezoneDropdown = new Vue({
el,
data() {
return {
value: initialValue,
};
},
render(h) {
return h(TimezoneDropdown, {
props: {
value: this.value,
timezoneData: timezones,
name,
},
class: 'gl-md-form-input-lg',
});
},
});
return timezoneDropdown;
};