fix(web): timezone dropdown showing "No results" when seconds are set to 00 (#24662)

* Fix timezone dropdown showing "No results" when seconds are set to 00

* remove comments

* add test for #23615
This commit is contained in:
Timon
2025-12-19 15:58:17 +01:00
committed by GitHub
parent f7cbb7417c
commit 2e1f8625ec
2 changed files with 36 additions and 1 deletions
@@ -71,6 +71,34 @@ describe('DateSelectionModal component', () => {
expect(onClose).toHaveBeenCalled();
});
test('does not fall back to UTC when datetime-local value has no seconds', async () => {
render(AssetSelectionChangeDateModal, {
props: { initialDate, initialTimeZone, assets: [], onClose },
});
await fireEvent.input(getDateInput(), { target: { value: '2024-01-01T00:00' } });
await fireEvent.blur(getDateInput());
expect(getTimeZoneInput().value).toBe('Europe/Berlin (+01:00)');
await fireEvent.focus(getTimeZoneInput());
expect(screen.queryByText('no_results')).not.toBeInTheDocument();
});
test('does not fall back to UTC when datetime-local value has no milliseconds', async () => {
render(AssetSelectionChangeDateModal, {
props: { initialDate, initialTimeZone, assets: [], onClose },
});
await fireEvent.input(getDateInput(), { target: { value: '2024-01-01T00:00:00' } });
await fireEvent.blur(getDateInput());
expect(getTimeZoneInput().value).toBe('Europe/Berlin (+01:00)');
await fireEvent.focus(getTimeZoneInput());
expect(screen.queryByText('no_results')).not.toBeInTheDocument();
});
describe('when date is in daylight saving time', () => {
const dstDate = DateTime.fromISO('2024-07-01');