我正在使用 react-datepicker 和 react-hook-form。但是我的选择器在结果中添加了时区:
const FormDatePicker = props => {
return (
<>
<Label for="exampleEmail">{props.label}</Label>
<Controller
as={
<DatePicker
isClearable
name={props.name}
className={"form-control"}
showTimeSelect
timeFormat="HH:mm"
timeIntervals={15}
timeCaption="time"
dateFormat="dd-MM-yyyy H:mm"
autoComplete="Off"
/>
}
control={props.control}
rules={{ required: false }}
valueName="selected"
onChange={([date]) => date}
name={props.name}
placeholderText="Select date"
defaultValue={null}
/>
</>
);
};