我已将 ISO 日期字符串转换为 momentjs 时刻,然后使用.format("MM/DD/YYYY HH:MM")
.
当我输出最终格式化时刻时,分钟值与最初从 iso 字符串读回的值不正确。
在这种情况下,ISO 字符串值包含 3:10 PM 或字符串中表示的“2016-08-03T03:10:00.000Z”。But when I call format the moment value is 4:07PM meaning three minutes have been subtracted during the format.
在调试期间,我在每个分配阶段都记录了以下值:
第 1 步(将 db 值转换为 ISO 字符串):
var actualBCR_Local = moment.utc('@Model.Escalation.Actual_BCR_ISO').toISOString();
value: "2016-08-03T03:10:00.000Z"
第 2 步(将 ISO 字符串转换为 momentjs 时刻以表示当地时间 GMT+1):
var actualBCR_Local_Moment = moment(actualBCR_Local);
value: Wed Aug 03 2016 04:10:00 GMT+0100 (GMT Daylight Time)
第 3 步(以 12HR 格式格式化演示文稿,问题就在这里,因为我失去了 3 分钟,而原始值应该是 04:10):
var actualBCR_Local_Formatted = actualBCR_Local_Moment.format("MM/DD/YYYY HH:MM");
value: "08/03/2016 04:08"
以 12HR 格式格式化时刻时,如何防止丢失分钟精度?