力矩JS时间和日期不一样
API响应:
Create_on:“ 2022-06-06T12:00:37.000Z”
UI代码:
<div style={{whiteSpace: 'nowrap'}}>Created On :</div>
<b style={{ marginLeft: '20px', fontSize: 15 }}>{createdOn ? moment.utc(createdOn).format('MMMM Do YYYY, HH:mm a') : ''}</b>
输出:
2022年6月16日,上午10:28 AM
预期输出:
2022年6月6日,2022年6月6日,12:00 AM
THNX提前。
API RESPONSE :
created_on: "2022-06-06T12:00:37.000Z"
UI CODE :
<div style={{whiteSpace: 'nowrap'}}>Created On :</div>
<b style={{ marginLeft: '20px', fontSize: 15 }}>{createdOn ? moment.utc(createdOn).format('MMMM Do YYYY, HH:mm a') : ''}</b>
OUTPUT :
JUNE 16th 2022, 10:28 am
EXPECTED OUTPUT :
JUNE 6th 2022, 12:00 am
thnx in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将您的“创建”变量添加到ITC上的内部矩()中。
Add your "createdOn" variable to inside moment() not on utc.