I have a date that I receive from a mySQL database via an API. This date comes in as the expected mySQL format: yyyy-MM-dd. I then reformat this to MM-dd-yyyy with the following JS:
const date = data.dateOfService;
const [year, month, day] = date.split('-');
const dateObj = {month, day, year};
value = (dateObj.month + '-' + dateObj.day + '-' + dateObj.year);
Where value is the field in form.io that the calculation/script is taking place. At any rate, the issue is that I actually need to display the previous day of the original MySQL date.
yyyy-MM-dd -1 => MM-dd-yyyy
Does anyone know how this can be approached? I am stumped.