Reputation: 453
I using moment JS
my time now is 12/01/2020 17:30
moment().format("LLL");
I get the right hour and date 1 December 2020 17:30moment().add(0, "days");
I get wrong hour "2020-12-06T15:30:52.046Z"why is it ? and how can I declare globally to set the right time of my country (im in jerusalem its +02:00 gmt)
my global config is :
moment.updateLocale("he", {
weekdays: ["ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת"],
longDateFormat: {
LT: "HH:mm",
LTS: "HH:mm:ss",
L: "DD/MM/YYYY",
LL: "D MMMM YYYY",
LLL: "D MMMM YYYY HH:mm",
LLLL: "dddd D MMMM YYYY HH:mm",
},
});
Upvotes: 0
Views: 597
Reputation: 505
Everything is fine but in the first example you use format
to display a formatted time but in second you are not using format.
Try it like so: moment().add(0, "days").format("LLL");
and it will work.
2020-12-06T15:30:52.046Z
Is a time and date format that date is using to calculate local time for specific time zone.
Upvotes: 1