If we have this format 2023-05-08T22:30:00+00:00
and want to formating this string to this format YYYY-MM-DD, the result is 2023-05-09 while I want 2023-05-08 as result . why?
moment('2023-05-08T22:30:00+00:00').format('YYYY-MM-DD'), get this result => 2023-05-09
Looks like a timezone issue. Since your input time is in UTC (+00:00), I think your machine timezone is in Tehran (+03:30), which changes the date to the next day.
If we have this format 2023-05-08T22:30:00+00:00 and want to formating this string to this format YYYY-MM-DD, the result is 2023-05-09 while I want 2023-05-08 as result . why?
moment('2023-05-08T22:30:00+00:00').format('YYYY-MM-DD'), get this result => 2023-05-09