Skip to content

Commit

Permalink
feat: stats évolutives - sélection des indicateurs
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud AMBROSELLI committed Feb 5, 2024
1 parent e0b8c3d commit 5ca2ff5
Show file tree
Hide file tree
Showing 7 changed files with 456 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
import { dateForInputDate, dateFromInputDate, LEFT_BOUNDARY_DATE, RIGHT_BOUNDARY_DATE } from '../services/date';

/**
* @typedef {Object} DatePickerProps
* @property {function} onChange
* @property {string} defaultValue
* @property {string} id
* @property {boolean} withTime
* @property {string} name
*/
/**
* @param {DatePickerProps} props
* @returns {JSX.Element}
*/
export default function DatePicker({ onChange, defaultValue, id, withTime = false, name = null }) {
interface DatePickerProps {
onChange: (e: { target: { name: string; value: Date | null } }) => void;
defaultValue: Date | null;
id: string;
withTime?: boolean;
name?: string;
}

export default function DatePicker({ onChange, defaultValue, id, withTime = false, name = '' }: DatePickerProps): JSX.Element {
return (
<input
id={id}
name={name || id}
key={withTime}
key={`${withTime}`}
className="form-control"
type={withTime ? 'datetime-local' : 'date'}
defaultValue={dateForInputDate(defaultValue, withTime)}
Expand Down
Loading

0 comments on commit 5ca2ff5

Please sign in to comment.