I'm working in Typescript and I am getting a Date object from data and expected to put a Date object back.
The Date object is adjusting for timezone and that is NOT behavior that I want...I just want the Date that I was given to use and be able to pass that around and put it back.
dateString = Tue Jun 02 2020 00:00:00 GMT+1030 (Lord Howe Standard Time)
const dateOptions = {timeZone: 'America/Chicago', month: 'numeric', day: 'numeric', year:
'numeric'};
const dateFormatter = new Intl.DateTimeFormat('en-US', dateOptions);
const offset = Math.abs(dateString.getTimezoneOffset() / 60) ;
const offSetDate = new Date(dateString);
offSetDate.setHours(0,0,0,0);
offSetDate.setDate(day);
const dateAsFormattedString = dateFormatter.format(offSetDate);
This returns "6/1/2020" not "6/2/2020" how can I just use the date I need as a date and ignore timezone? Sorry for all the code, I feel like I've tried everything...why is this so hard?
Any help is greatly appreciated!!