custom javascript – List Dates Off by One Day

I am having issues with dates in a SharePoint 2013 list.

At a high level I am archiving the dates of the selected item in List1, storing them in List 2. The dates in the selected item are updated to new dates with my code.

Seems when I retrieve the dates from List1 using a REST call I get the proper date back. I am converting the date to a MM/DD/YYYY format and then storing it in List2 but the List2 date is off by one.

The argument isoDate is the value from the REST response so the value I am getting from REST looks like “2020-02-17T06:00:00Z”. List1 date is 2/17/2020. So all good.

The return (mydate) is 2/16/2020 and this value is getting stored into List2 and also displayed on my custom form…but it’s wrong!

I could add one day to the date but that is likely not the solution here. Not sure why that return date is getting reduced by one day and how to resolve it.

Thanks.

GetDate: function (isoDate) //3.5 namespace addition
    {
        
        var testdate=new Date(isoDate);
        var mydate=moment(testdate).format('MM/DD/YYYY');
        
        return mydate;

I have looked at other posts but they have not been useful.