Skip to content

Commit

Permalink
Added support for now keyword in time range selector
Browse files Browse the repository at this point in the history
  • Loading branch information
manojVivek committed Jan 2, 2024
1 parent 3972628 commit fd28518
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ui/packages/shared/components/src/DateTimePicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ const DateTimePicker = ({selected, onChange}: Props): JSX.Element => (
showTimeInput
dateFormat="yyyy-MM-dd HH:mm:ss"
className="h-[38px] w-full rounded-md border border-gray-200 p-2 text-center text-sm dark:border-gray-600 dark:bg-gray-900"
onChangeRaw={event => {
if (event.target.value === 'now') {
onChange(new Date());
}
}}
/>
);

Expand All @@ -37,6 +42,11 @@ export const UTCDateTimePicker = ({selected, onChange}: Props): JSX.Element => (
showTimeInput
dateFormat="yyyy-MM-dd HH:mm:ss"
className="flex h-[38px] w-full rounded-md border border-gray-200 p-2 text-center text-sm dark:border-gray-600 dark:bg-gray-900"
onChangeRaw={event => {
if (event.target.value === 'now') {
onChange(new Date());
}
}}
/>
);

Expand Down

0 comments on commit fd28518

Please sign in to comment.