像这样可能吗?尝试格式化日期formatted_short
<Generic type="startDate" jsonldtype="DateTime" schema={{
startDate: `${props.dates[0].start_date.formatted_short.format('YYYY-MM-DD')}`,
endDate: `${props.dates[0].end_date.formatted_short}`,
doorTime: `${props.dates[0].start_date.time}`,
}}/>
答案 0 :(得分:1)
您可以将react-moment用于保存日期。
您可以这样使用
import React from 'react';
import Moment from 'react-moment';
export default class MyComponent extends React.Component {
render() {
return (
// format : your format.
<Moment format="YYYY/MM/DD">
1976-04-19T12:59-0500 // your date string
</Moment>
);
}
}
答案 1 :(得分:1)
时刻示例:
<Generic type="startDate" jsonldtype="Date" schema={{
startDate: Moment(`${props.dates[0].start_date.formatted_short}`).format('YYYY-MM-DD'),
endDate: Moment(`${props.dates[0].end_date.formatted_short}`).format('YYYY-MM-DD'),
doorTime: Moment(`${props.dates[0].start_date.time}`).format('hh:mm:ss')
}}/>
有人需要吗