Skip to content

Instantly share code, notes, and snippets.

@bubbobne
Created July 13, 2017 08:56
Show Gist options
  • Save bubbobne/1cb2f2047a0c625d039567274dd2180f to your computer and use it in GitHub Desktop.
Save bubbobne/1cb2f2047a0c625d039567274dd2180f to your computer and use it in GitHub Desktop.
utility per javascript
/**
* Add the time zone offset to a data.
*
*
* @param {Date} data - The Date to transform.
*/
function getDataWithOffset(data){
var tzoffset = (new Date()).getTimezoneOffset() * 60000;
return new Date(data - tzoffset);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment