Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 | 28x 28x | // Formats a Date as "YYYY-MM-DDTHH:MM" in the user's local time zone, which is
// what a datetime-local input expects. (toISOString() alone would give UTC.)
export function localDateTimeString(date) {
const offsetMs = date.getTimezoneOffset() * 60000;
return new Date(date.getTime() - offsetMs).toISOString().slice(0, 16);
}
|