I have gone through lot of threads on this and looks like we can't change the browser's timezone programmatically. We have moment-timezone.js library using which we can set timezone but that is applicable only to its objects. If you are still using javascript native new Date(), then you will still get date in browsers timezone.
I am having angularjs application where I am using kendo Ui Widgets and momentjs library for dates.
I will have to take care of both Kendo and momentjs independently everywhere in the code. So question again here is, Is there really NO way we can set the browsers timezone programmatically like we do for Java applications using JVM user.timezone VM argument ?
Thanks Matt, but I can't control which browser user will use. Can I override javascript date constructor, do you see any issue in that approach ?
var origConst = Date.prototype.constructor;
Date = function(Date) {
var d = new origConst();
var timeZoneDiff = -5; //time zone value of user
//get the timezone offset from local time in minutes
var tzDifference = timeZoneDiff * 60 + d.getTimezoneOffset();
var newD = new origConst(d.getTime() + (tzDifference * 60 * 1000));
return newD;
};