How to set default timezone in angular js

I want to set the default clockwise offset (America / Chicago) in the date field. the new Date function has been added to the code and fits it correctly in the HTML file. its date and time display is correct, but I want to set the time zone to the default value for America / chicago. code in the controller:

<script>
    mainApp.controller('depositController', ['$scope', '$http', '$filter', function($scope, $http, $filter) {	
          $scope.myDate = new Date();	
    }]); 	
</script>
Run codeHide result

html code:

<div class="col-lg-8">
  <input id="deposit_date" name="deposit_date" 
        class="form-control"       
        type="text" 
        ng-init="deposit_time=(myDate | date:'HH:mm:ss a' : '-0500')" 
        ng-model="deposit_time" 
        readonly="readonly"/>
</div>
Run codeHide result

I want to show the current time America / Chicago (Central Standard Time).

+4
source share
2 answers

You can not. AngularJS uses browser timezone settings.

See the documentation:


- AngularJS .
- , .
- JavaScript AngularJS , .

0

. .

  • AngularJS .
  • , .
  • JavaScript AngularJS ,
0

Source: https://habr.com/ru/post/1679707/


All Articles