[英]DesktopDatePicker as React Component cannot change the format of date
I am trying to change the format of the component but in the UI is still month-year-date displayed.我正在尝试更改组件的格式,但在 UI 中仍显示月-年-日期。
<DesktopDatePicker
inputVariant="outlined"
label="Pick-up date"
id="date-picker-dialog"
name="startDate"
onChange={(val) => {
formik.setFieldValue("startDate", val);
}}
renderInput={(params) => <TextField {...params} />}
onBlur={formik.handleBlur}
value={formik.values.startDate}
// format date-month-year
format="dd-MM-yyyy"
error={formik.errors.startDate && formik.touched.startDate}
/>
add this to component inputFormat="dd/MM/yyyy"
将此添加到组件
inputFormat="dd/MM/yyyy"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.