-
Notifications
You must be signed in to change notification settings - Fork 5
/
DateTimeInput.jsx
47 lines (41 loc) · 1.04 KB
/
DateTimeInput.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import React from 'react';
import PropTypes from 'prop-types';
import LineInput from './LineInput';
import { pathPropType } from '../helpers/pathHelpers';
/*
* This is currently a read-only input.
*/
const propTypes = {
name: PropTypes.string,
// TODO: Stop using propTypes in isInput. Until then, these unused props need to be declared so
// this component is recognized as an input.
/* eslint-disable react/no-unused-prop-types */
parentPath: pathPropType,
subpath: pathPropType,
/* eslint-enable react/no-unused-prop-types */
value: PropTypes.string,
formatValue: PropTypes.func,
};
const defaultProps = {
name: undefined,
parentPath: undefined,
subpath: undefined,
value: undefined,
formatValue: undefined,
};
export default function DateTimeInput(props) {
const {
name,
value,
formatValue,
} = props;
return (
<LineInput
name={name}
readOnly
value={formatValue ? formatValue(value) : value}
/>
);
}
DateTimeInput.propTypes = propTypes;
DateTimeInput.defaultProps = defaultProps;