Commit b8e38e38 authored by Peter Hegman's avatar Peter Hegman

Merge branch 'JonstonChan-345925-fix-schedule-resets-to-utc' into 'master'

Fix pipeline schedule resets to UTC on edit

See merge request gitlab-org/gitlab!77723
parents 52b1023c d5298c29
import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown'; import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown';
const defaultTimezone = { name: 'UTC', offset: 0 }; const defaultTimezone = { identifier: 'Etc/UTC', name: 'UTC', offset: 0 };
const defaults = { const defaults = {
$inputEl: null, $inputEl: null,
$dropdownEl: null, $dropdownEl: null,
...@@ -70,7 +70,7 @@ export default class TimezoneDropdown { ...@@ -70,7 +70,7 @@ export default class TimezoneDropdown {
setDropdownValue(timezone) { setDropdownValue(timezone) {
this.$dropdownToggle.text(this.displayFormat(timezone)); this.$dropdownToggle.text(this.displayFormat(timezone));
this.$input.val(timezone.name); this.$input.val(timezone.identifier);
} }
handleDropdownChange({ selectedObj, e }) { handleDropdownChange({ selectedObj, e }) {
......
...@@ -38,14 +38,14 @@ describe('Timezone Dropdown', () => { ...@@ -38,14 +38,14 @@ describe('Timezone Dropdown', () => {
const tzStr = '[UTC + 5.5] Sri Jayawardenepura'; const tzStr = '[UTC + 5.5] Sri Jayawardenepura';
const tzValue = 'Asia/Colombo'; const tzValue = 'Asia/Colombo';
expect($inputEl.val()).toBe('UTC'); expect($inputEl.val()).toBe('Etc/UTC');
$(`${tzListSel}:contains('${tzStr}')`, $wrapper).trigger('click'); $(`${tzListSel}:contains('${tzStr}')`, $wrapper).trigger('click');
const val = $inputEl.val(); const val = $inputEl.val();
expect(val).toBe(tzValue); expect(val).toBe(tzValue);
expect(val).not.toBe('UTC'); expect(val).not.toBe('Etc/UTC');
}); });
it('will format data array of timezones into a list of offsets', () => { it('will format data array of timezones into a list of offsets', () => {
...@@ -67,7 +67,7 @@ describe('Timezone Dropdown', () => { ...@@ -67,7 +67,7 @@ describe('Timezone Dropdown', () => {
it('will default the timezone to UTC', () => { it('will default the timezone to UTC', () => {
const tz = $inputEl.val(); const tz = $inputEl.val();
expect(tz).toBe('UTC'); expect(tz).toBe('Etc/UTC');
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment