I think that finding out if this is enabled will not be possible (I'm not sure, maybe there's some compiled plugin that works, so far I have not found anything), but I can try to compare the value of " / p>
And create a page with HTTP response in any format, for example JSON, that returns the time of your server, this page being configured with the desired timezone.
For example to get the cell timezone would be this:
let tz = new Date().getTimezoneOffset();
console.log(tz);
Or pick up the current time and compare it with some API service (own or third party):
console.log(new Date().toString());
And with an HTTP request using Date
could get the data from the server and compare it, which will require some development in the back end, however alternatively there are third party services that return this type of data, such as google maps: link
Then you could send the request in $http
to:
https://maps.googleapis.com/maps/api/timezone/json?location=<LATITUDE>,<LONGITUDE>×tamp=<TEMPO ATUAL EM SEGUNDOS>&key=<SUA CHAVE DA CONTA DE DESENVOLVEDOR GOOGLE>
You will have to use something to get the user's current location, so change:
-
$http
by length takes
-
<LATITUDE>
by length takes
-
% by% by% by%
-
<LONGITUDE>
your developer key, you must have a developer account to use the Google Maps services.
Another possible solution would be to use the link service (there are others of the same type), in the case of using this function: link
For some in-app actions, I need to make sure that the user has Automatic Time Zone enabled so that he does not send data with false date / time, otherwise he can not proceed.
In this case simply send the request time to the payload, something like:
$http({
url: 'http://foo.bar/api/foo/bar',
method: 'POST',
data: {
'foo': $scope.foo,
'bar': $scope.bar,
'time': new Date().toUTCString()
}
}).then(function (response) {
console.log("sucesso", response);
}, function (response) {
console.log("falhou", response);
});
Of course take into consideration that Brazil has different time zones, so it would be interesting to send in UTC to do from this the check in the back end, then in your HTTP server, where you will communicate with your service, check the parameter <TEMPO ATUAL EM SEGUNDOS>
of the payload, in your case I believe it is PHP, then I would do this:
strtotime($_POST['time']);
Then you will have the value in seconds, which may use Date.now()
(I think this would be it, I have not tested it yet) and compare it with server values, only year, month and time. Minutes may be irrelevant and may not be very accurate.
I did not create anything, but it's just the idea for you to implement.