I have a momentjs object that hold a datetime with an offset. This moment object was created from its string representation:
var x = moment("2017-02-08T04:11:52+6:00")
After working with the object, I would like to get the same textual representation from the moment object.
I get the following results when trying to format the object:
x.format()
=>"2017-02-08T04:11:52+14:00"
moment.parseZone(x).format("YYYY-MM-DDTHH:mm:ssZ")
=>"2017-02-07T14:11:52+00:00"
How can I format my moment object such that I have the exact same representation again?
x.format()
gives me (moment2.17.1
, tzEurope/Rome
)Invalid date
and Deprecation warning. I fear that the problem is+6:00
instead of+06:00
(2 digit) for offset in your input string