Which way ?
If you send 2024/02/04 do you get 2024-02-05 back ?
or
If you send 2024/02/04 do you get 2024-02-03 back ?
Regardless, amend your script line for the date to look like this:
ref.push(Utilities.formatDate(rg[i][1], Session.getScriptTimeZone(), 'YYYY-MM-dd'));
Does that work ?
If not try this
ref.push(Utilities.formatDate(rg[i][1], SpreadsheetApp.getActive().getSpreadsheetTimeZone() 'YYYY-MM-dd'));