Skip to content

Instantly share code, notes, and snippets.

View OutsourcedGuru's full-sized avatar
🏠
Working from home

Outsourced Guru OutsourcedGuru

🏠
Working from home
  • New Mexico, USA
View GitHub Profile
@OutsourcedGuru
OutsourcedGuru / timezone.js
Created November 22, 2017 16:37
JavaScript Array Prototype
(function() {
Date.prototype.toLocalTime = function() {
// PDT -0700 = -7 * 60 = -420 minutes in the timezone offset from GMT to PDT
var nMillisecondsInMinute = 60000;
var nMillisecondsThis = this.getTime();
// Compensate for the GMT-stored time on production
if (isProduction)
nMillisecondsThis -= (420 * nMillisecondsInMinute);
return new Date(nMillisecondsThis);
};