Commit 485de1fe authored by peterhegman's avatar peterhegman

Remove option to clear time zone dropdown

Per UX reviewer feedback
parent 4840ed7f
......@@ -17,13 +17,7 @@ export const formatUtcOffset = (offset) => {
return `${prefix} ${Math.abs(offset / 3600)}`;
};
export const formatTimezone = (item) => {
if (Object.prototype.hasOwnProperty.call(item, 'offset')) {
return `[UTC ${formatUtcOffset(item.offset)}] ${item.name}`;
}
return item.name;
};
export const formatTimezone = (item) => `[UTC ${formatUtcOffset(item.offset)}] ${item.name}`;
export const findTimezoneByIdentifier = (tzList = [], identifier = null) => {
if (tzList && tzList.length && identifier && identifier.length) {
......@@ -45,15 +39,6 @@ export default class TimezoneDropdown {
this.$input = $inputEl;
this.timezoneData = this.$dropdown.data('data') || [];
if (allowEmpty) {
this.timezoneData = [
{
name: this.$dropdownToggle.text(),
},
...this.timezoneData,
];
}
this.onSelectTimezone = onSelectTimezone;
this.displayFormat = displayFormat || defaults.displayFormat;
this.allowEmpty = allowEmpty;
......
......@@ -81,12 +81,6 @@ describe('Timezone Dropdown', () => {
it('will default the value of the input to an empty string', () => {
expect($inputEl.val()).toBe('');
});
it('will add a new dropdown item for selecting an empty value', () => {
expect(
$(`${tzListSel}:contains('${findDropdownToggleText().html()}')`, $wrapper).length,
).not.toBe(0);
});
});
});
......@@ -202,14 +196,6 @@ describe('Timezone Dropdown', () => {
}),
).toEqual('[UTC 0] Accra');
});
it('returns name when no offset is provided', () => {
expect(
formatTimezone({
name: 'Foo bar',
}),
).toEqual('Foo bar');
});
});
describe('findTimezoneByIdentifier', () => {
......
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