I am not a programmer/developer, but I have implemented a fair number of simple customizations to our Zendesk forms using jQuery and JavaScript. For several of our forms, we copy the date selected by the end user into the form subject line on submit, along with a couple of other field entries to build the ticket title (primarily user account creation and termination forms). We noticed recently that sometimes form submissions are coming in with a ticket title/subject date that is actually one day prior to the user selected date. It doesn't seem to be dependent on the time of day the submission was made or location of end user; we're all in one Midwest state in central standard time and this was affecting various tickets submitted throughout the day.
As it turns out, the date picker field value of 2025-07-30 is considering time zone so ‘2025-07-30’ is read as ‘Tue Jul 29 2025 19:00:00 GMT-0500 (Central Daylight Time). An abbreviated form of the latter is what was being copied into the ticket subject/title (Jul 29 2025) which is one day prior than the actual user-selected date. So while the form field entry remained correct, the ticket subject displayed an incorrect date.
To remedy this, we converted the date picker field value from ‘2025-07-30’ to ‘2025/07/30’ which is read as 'Wed Jul 30 2025 00:00:00 GMT (Central Daylight Time) which matches the user selected date. Here is the code we used to covert the date format:
// Change date format from YYYY-MM-DD to YYYY/MM/DD
var hyphenated_date = $('#request_custom_fields_XXXXX').val();
var date_with_slashes = datehyphen.replace(/-/g, '/');
// Parse date string into a Date object
var dateObject = new Date(date_with_slashes);
// Format the Date object into ‘Mon DD, YYYY’ output string
var options = { month: 'short', day: 'numeric', year: 'numeric' };
var formattedDate = dateObject.toLocaleDateString('en-US', options);
Hope this helps someone else encountering the same issue:)