Skip to content

Instantly share code, notes, and snippets.

@patricksimpson
Last active January 19, 2022 23:52
Show Gist options
  • Save patricksimpson/f0108b43c26ea85ee6d8c5f281ab011e to your computer and use it in GitHub Desktop.
Save patricksimpson/f0108b43c26ea85ee6d8c5f281ab011e to your computer and use it in GitHub Desktop.
date string to local
function dateToLocal(date) {
let localOffset = new Date().getTimezoneOffset() * 60 * 1000;
let d = new Date(Date.parse(date));
return new Date(d.getTime() + localOffset);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment