diff --git a/src/lib/components/timezone-select.svelte b/src/lib/components/timezone-select.svelte index bbdee5d228..f29aa8963a 100644 --- a/src/lib/components/timezone-select.svelte +++ b/src/lib/components/timezone-select.svelte @@ -123,6 +123,7 @@ id="timezones-menu" {position} class="w-[10rem] sm:w-[20rem] md:w-[28rem]" + maxHeight="" > + setTimestampFormat('iso')}>ISO - {#if !search} - {#each QuickTimezoneOptions as { value, label }} +
+ {#if !search} + {#each QuickTimezoneOptions as { value, label }} + selectTimezone(value)} + data-testid="timezones-{value}" + selected={value === $timeFormat} + description={value === BASE_TIME_FORMAT_OPTIONS.LOCAL + ? localTime + : undefined} + > + {label} + + {/each} + {/if} + + {#each filteredOptions as { value, label, offset, abbr }} selectTimezone(value)} - data-testid="timezones-{value}" selected={value === $timeFormat} - description={value === BASE_TIME_FORMAT_OPTIONS.LOCAL - ? localTime - : undefined} + onclick={() => selectTimezone(value)} + description={formatUTCOffset(offset, translate('common.utc'))} > - {label} + {label} ({abbr}) + {:else} + {translate('common.no-results')} {/each} - - - {/if} - - {#each filteredOptions as { value, label, offset, abbr }} - selectTimezone(value)} - description={formatUTCOffset(offset, translate('common.utc'))} - > - {label} ({abbr}) - - {:else} - {translate('common.no-results')} - {/each} +
diff --git a/src/lib/pages/workflows-with-new-search.svelte b/src/lib/pages/workflows-with-new-search.svelte index 0da218970f..ecd4be0525 100644 --- a/src/lib/pages/workflows-with-new-search.svelte +++ b/src/lib/pages/workflows-with-new-search.svelte @@ -98,7 +98,7 @@ }); $effect(() => { - $workflowsQuery = query; + $workflowsQuery = query ?? ''; }); $effect(() => { @@ -228,8 +228,8 @@
-
-
+
+

{#if $supportsAdvancedVisibility} {/if}

-

- {refreshTimeFormatted} -

+ +
- - +

+ {refreshTimeFormatted} +

{#if $$slots['header-actions'] || workflowStartEnabled}
diff --git a/src/lib/utilities/format-date.test.ts b/src/lib/utilities/format-date.test.ts index ed77fd0be7..25db68fb4d 100644 --- a/src/lib/utilities/format-date.test.ts +++ b/src/lib/utilities/format-date.test.ts @@ -147,6 +147,9 @@ describe('formatDate', () => { expect(formatDate(date, 'utc', { format: 'long' })).toEqual( 'April 13, 2022 at 4:29:35.63 PM UTC', ); + expect(formatDate(date, 'utc', { format: 'iso' })).toEqual( + '2022-04-13T16:29:35.630Z', + ); }); }); diff --git a/src/lib/utilities/format-date.ts b/src/lib/utilities/format-date.ts index f9a775187f..a91758fd3b 100644 --- a/src/lib/utilities/format-date.ts +++ b/src/lib/utilities/format-date.ts @@ -57,7 +57,7 @@ export const timestampFormats: Record< }, } as const; -export type TimestampFormat = keyof typeof timestampFormats; +export type TimestampFormat = keyof typeof timestampFormats | 'iso'; export function formatDate( date: ValidTime | undefined | null, @@ -82,18 +82,22 @@ export function formatDate( const parsed = parseJSON(new Date(date)); - if (timeFormat === BASE_TIME_FORMAT_OPTIONS.LOCAL) { - if (relative) { - return ( - formatDistanceToNowStrict(parsed, { - ...(!flexibleUnits && - Math.abs(differenceInHours(currentDate, parsed)) > 24 && { - unit: 'day', - }), - }) + ` ${relativeLabel}` - ); - } + if (relative) { + return ( + formatDistanceToNowStrict(parsed, { + ...(!flexibleUnits && + Math.abs(differenceInHours(currentDate, parsed)) > 24 && { + unit: 'day', + }), + }) + ` ${relativeLabel}` + ); + } + if (format === 'iso') { + return parsed.toISOString(); + } + + if (timeFormat === BASE_TIME_FORMAT_OPTIONS.LOCAL) { return new Intl.DateTimeFormat( undefined, timestampFormats[format], @@ -127,6 +131,7 @@ export function formatUTCOffset( absoluteValue > 9 ? `${absoluteValue}:00` : `0${absoluteValue}:00`; if (offset > 0) return `${utc}+${formattedOffset}`; if (offset < 0) return `${utc}-${formattedOffset}`; + return ''; } export function getLocalTimezone(): string {