I have a strange problem I dont quite understand.
Why moment will use strange timezone (+01:45) by default and not using the one I provided in input string?
I propably don't correctly understand how moment works or I am missing something very basic. I tried testing and found out I need to use parseZone() by just experimenting with different options. I don't know if its the correct way to solve problem where I need get the same date out of moment I put into it.
If I use any timezone +01,+02 or +03(my current) in moment input string I get previous date and strange time/timezone. For +00:00 it will work, but I cannot choose this timezone since its the timezone I get from a service.
moment("1800-01-01T00:00:00.000+03:00").format() =>
1799-12-31T22:39:49+01:45
but
moment("1800-01-01T00:00:00.000+03:00").parseZone().format() will give corrent output
1800-01-01T00:00:00+03:00
This is when I live in +03:00 GMT (Summer time). Colleagues who live in +02:00 (Summer time too) get correct results (and most of you will propably too)
My results of below javascript sandbox are:
1799-12-31T22:39:49+01:45
1800-01-01T00:00:00+03:00
I use google chrome (100.0.4896.127 64-bit) and my locale in windows 11 is Finnish / Finland (up to date).
import "./styles.css";
var moment = require("moment");
let checkDate = moment("1800-01-01T00:00:00.000+02:00");
//checkDate = checkDate.utcOffset(0, true);
// let fixedDate = checkDate.add('minutes',checkDate.utcOffset());
document.getElementById("app").innerHTML = checkDate.format() + "<br>";
document.getElementById("app").innerHTML += checkDate.parseZone().format();