【发布时间】:2020-03-05 16:49:45
【问题描述】:
这是我的 JSON:
orders:[{
"buyerEmail": "unknow@gmail.com",
"profile_name_ru": "ПРЕДПРИНИМАТЬ",
"bin": "20940010947",
"date_time": "15.10.2019 10:39:27"
}
]
我正在获取 date_time 并将其输出到这样的 React Native 应用程序上。
<View>
<Text>{orders.dateTime}</Text>
</View>
它正在显示。 但如果我使用 Moment.js。我会收到无效日期。
render(){
const ed = (order.dateTime);
const check = moment(new Date(ed)).format("DD.MM.YYYY, HH:MM");
return (
<View>
<Text>{check}</Text>
</View>
)
}
谁能告诉我为什么我的日期无效?
【问题讨论】:
-
试试
"DD.MM.YYYY HH:mm:ss"
标签: javascript json reactjs react-native