Use dateTime vs new Date() (#37210)

This commit is contained in:
Alex Khomenko 2021-07-26 19:18:15 +03:00 committed by GitHub
parent b5f464412d
commit 8c8d2fe08b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
import React, { ChangeEvent } from 'react';
import { css } from '@emotion/css';
import { dateTimeFormat } from '@grafana/data';
import { dateTime, dateTimeFormat } from '@grafana/data';
import { DatePicker } from '../DatePicker/DatePicker';
import { Props as InputProps, Input } from '../../Input/Input';
import { useStyles } from '../../../themes';
@ -46,7 +46,7 @@ export const DatePickerWithInput = ({
/>
<DatePicker
isOpen={open}
value={value && typeof value !== 'string' ? value : new Date()}
value={value && typeof value !== 'string' ? value : dateTime().toDate()}
onChange={(ev) => {
onChange(ev);
if (closeOnSelect) {