I am getting a date time from an api 2022-04-01T00:00:00.000Z,
and I am using moment to get day and date from the api response in following way:
console.log(moment(resp.data.shift_date).format('ddd, MMM Do, YYYY'));
OUTPUT: Thu, Mar 31st, 2022.
But the date which I am getting from api is of 1st april, 2022. I am not sure what I am doing wrong
try moment.utc(dt).format('ddd, MMM Do, YYYY')
dt is your date coming from API.