Repository: temporalio/ui (ts)

Issue:
[Bug] unable to convert filter expression, invalid StartTime format sent to server
### What are you really trying to do?

I am trying to run the temporal UI `temporalio/ui-server` v0.2.0 with `temporalio/temporal` v1.14.4.

### Describe the bug

The default `GET` request `/api/v1/namespaces/default/workflows?query=StartTime+%3E+%222022-01-30T01%3A43%3A45%2B02%3A00%22` returns a 500 error:

```
{
  "code": 2,
  "message": "invalid query: unable to convert filter expression: unable to convert values of comparison expression: StartTime only supports BETWEEN ... AND ... filter",
  "details": [
  ]
}
```

The origin of the error seems to be this commit: https://github.com/temporalio/temporal/commit/1e191789e37069157e204ad3d72db33e4da9fa71

Pull request description:
Fix query for non-Elasticsearch instances (Closes #249)
Updates to a `StartTime` query that works with both Elasticsearch and Cassandra. 

Patch:
diff --git a/src/lib/utilities/list-workflow-query.ts b/src/lib/utilities/list-workflow-query.ts
index 8d425a44..b996f801 100644
--- a/src/lib/utilities/list-workflow-query.ts
+++ b/src/lib/utilities/list-workflow-query.ts
@@ -1,4 +1,4 @@
-import { isDuration, isDurationString, toDate } from './to-duration';
+import { isDuration, isDurationString, toDate, tomorrow } from './to-duration';
 
 type QueryKey =
   | 'WorkflowId'
@@ -55,7 +55,7 @@ const toQueryStatement = (key: FilterKey, value: FilterValue): string => {
   const queryKey = queryKeys[key];
 
   if (isDuration(value) || isDurationString(value)) {
-    return `${queryKey} > "${toDate(value)}"`;
+    return `${queryKey} BETWEEN "${toDate(value)}" AND "${tomorrow()}"`;
   }
 
   return `${queryKey}="${value}"`;
diff --git a/src/lib/utilities/to-duration.ts b/src/lib/utilities/to-duration.ts
index 00618d9a..bbf48d15 100644
--- a/src/lib/utilities/to-duration.ts
+++ b/src/lib/utilities/to-duration.ts
@@ -1,4 +1,4 @@
-import { formatISO, sub } from 'date-fns';
+import { formatISO, sub, add } from 'date-fns';
 
 type DurationKey = typeof durationKeys;
 
@@ -104,3 +104,7 @@ export const fromDate = (targetDate: string | Date): Duration => {
 
   return { seconds: difference / 1000 };
 };
+
+export const tomorrow = () => {
+  return formatISO(add(new Date(), { hours: 24 }));
+};


Test patch:
diff --git a/src/lib/utilities/list-workflow-query.test.ts b/src/lib/utilities/list-workflow-query.test.ts
index 24b87a99..a8aa760f 100644
--- a/src/lib/utilities/list-workflow-query.test.ts
+++ b/src/lib/utilities/list-workflow-query.test.ts
@@ -12,11 +12,14 @@ describe(toListWorkflowQuery, () => {
 
   it('should convert an timeRange with a Duration as a value', () => {
     jest.useFakeTimers().setSystemTime(new Date('2020-01-01').getTime());
+    const tomorrow = '2020-01-02T00:00:00Z';
     const twentyFourHoursEarlier = '2019-12-31T00:00:00Z';
 
     const query = toListWorkflowQuery({ timeRange: { hours: 24 } });
 
-    expect(query).toBe(`StartTime > "${twentyFourHoursEarlier}"`);
+    expect(query).toBe(
+      `StartTime BETWEEN "${twentyFourHoursEarlier}" AND "${tomorrow}"`,
+    );
   });
 
   it('should convert an two values using an "and"', () => {