We received reports from multiple users about a bug in the time sheet feature. When users were recording hours, the date would shift days from the one they selected. Today we've deployed a fix for this!
Date object of midnight in the local timezone. To convert it to the ISO day format that we use in the API, we originally used this code:
// WRONG const date = val.toISOString().substring(0, 10);
The issue is that the
toISOString method converts the
Date to the UTC timezone. This means that the calendar day may change!
The fix was to account for the UTC offset when calculating the date:
// CORRECT const dt = new Date(val); dt.setMinutes(dt.getMinutes() - dt.getTimezoneOffset()); const date = dt.toJSON().slice(0, 10);