I'm looking to show dates relative to the users' timezones.
My hope is that Angular has way to globally config the Date
filter to do this—having to do this manually on a case-by-case basis feels wrong.
My timestamps are already wrapped in a timestamp()
function (simply to multiply by 1000), but I'd prefer not to modify that function if I don't have to.
Edit:
I'm doing this, and it works, but as stated above, I'd like to set this one level higher if possible
$scope.timestamp = function (unix_time) {
var epoch = (unix_time * 1000);
var date = new Date();
var localOffset = (-1) * date.getTimezoneOffset() * 60000;
var stamp = Math.round(new Date(epoch + localOffset).getTime());
return stamp;
};