Created
December 6, 2019 18:33
-
-
Save FrancoAguilera/b1e06753abb4c99670e7148974ec4f5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date.prototype.addHours = function (h) { | |
this.setHours(this.getHours() + h); | |
return this; | |
} | |
var japanTimeOffset = 9; | |
var timeZoneOffset = new Date().getTimezoneOffset() / 60; | |
var japanCurrentTIme = new Date().addHours(japanTimeOffset + timeZoneOffset); | |
var inWorkingHours = japanCurrentTIme.getHours() >= 8 && japanCurrentTIme.getHours() < 20; | |
console.log('Japan current time --> ' + japanCurrentTIme.toTimeString()); | |
console.log('Japan bussines hours --> ' + inWorkingHours); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment