0

我有以下react-hook-form组件并使用react-datetime组件。该值是一个矩对象。我想要一个iso格式的字符串,例如:2021-11-03T18:30:00.000Z

<Controller
    name="resetDateTime"
    control={control}
    required
    rules={{
        required: {
            value: true,
            message: "Please provide reset Datetime",
        },
    }}
    render={({ field }) => (
        <Datetime
            {...field}
            inputProps={{
                placeholder: "MM-DD-YYYY HH:mm",
            }}
            viewMode="time"
        />
    )}
/>

https://codesandbox.io/s/nervous-johnson-v307e

4

0 回答 0