I have this line in my app:(我的应用程式中有这行:)
const createdOn: moment.Moment = moment.utc(created_on)
created_on
comes from an api endpoint like in this format:(created_on
来自api端点,格式如下:)
{
...,
created_on: "2019-03-08T15:32:26.285Z",
}
This basically imports created_on
as an UTC timezone.(这基本上将created_on
导入为UTC时区。) created_on
is also UTC
.(created_on
也是UTC
。) So, this method does not break the timezone and import UTC properly.(因此,此方法不会中断时区并正确导入UTC。) Also I have this one:(我也有这个:)
That generates current timestamp in UTC timezone.(这会在UTC时区生成当前时间戳。)
moment.utc()
Note that , If I just import date to moment and then convert it to UTC, my time goes wrong.(请注意 ,如果我只是将日期导入到时刻,然后将其转换为UTC,我的时间就会出错。) Moment by default assumes given date is equal to current visitors timezone.(默认情况下,时刻假设给定的日期等于当前访问者的时区。) I need to import time as it is.(我需要按原样导入时间。) Which is UTC all the time.(一直是UTC。)
What is the equivelant on Luxon
?(卢森堡的Luxon
什么?)
ask by Pratha translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…