Skip to content

Commit

Permalink
Fix error on MAT when dates typed in manually
Browse files Browse the repository at this point in the history
  • Loading branch information
majakomel committed Feb 24, 2023
1 parent 131dc0b commit 329cc9a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/aggregation/mat/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ export const Form = ({ onSubmit, testNames, query }) => {
const since = watch('since')
const until = watch('until')
const timeGrainOptions = useMemo(() => {
if (!since || !until) return ['hour', 'day', 'week', 'month']
const dateRegex = /^\d{4}-\d{2}-\d{2}$/
if (!until.match(dateRegex) || !since.match(dateRegex)) return ['hour', 'day', 'week', 'month']
const diff = dayjs(until).diff(dayjs(since), 'day')
if (diff < 8) {
const availableValues = ['hour', 'day']
Expand Down

1 comment on commit 329cc9a

@vercel
Copy link

@vercel vercel bot commented on 329cc9a Feb 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

explorer – ./

explorer-ooni1.vercel.app
explorer-one.vercel.app
explorer-git-master-ooni1.vercel.app

Please sign in to comment.