How to get browser to show server time
-
How do I get the browser charts and anything with time to show the server time and not the time local of the users browser?
I set the users timezone to use the server timezone but the times all appear as local times in the charts etc.
-
Yep all the charts and displays in the dashboards v3 module to not honor the users timezone setting, they always display the time in the browsers timezone. To display times as the servers timezone you have to manually configure your displays.
Regrettably there is no option to set the timezone for serial charts in the current release. I have added this for the next release, you can see the change here if you want to manually patch your module. So the below examples will work out of the box except for the serial chart.
<strong>Current server time</strong> <ma-now update-interval="1 SECONDS" output="time"></ma-now> <p ng-bind="time | moment:'tz':user.getTimezone() | moment:'format':'ll LTS Z z'"></p> <strong>Point value time in server timezone</strong> <ma-get-point-value point-xid="DP_698831" point="myPoint"></ma-get-point-value> <p>Point value is {{myPoint.renderedValue}} @ {{myPoint.time | moment:'tz':user.getTimezone() | moment:'format':'ll LTS Z z'}}</p> <strong>Point value time in server timezone</strong> <div layout="row"> <md-input-container flex> <label>Date preset</label> <ma-date-range-picker from="from" to="to" preset="LAST_1_DAYS" update-interval="1 minutes"></ma-date-range-picker> </md-input-container> </div> <ma-point-values point="myPoint" values="myPointValues" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"> </ma-point-values> <ma-serial-chart style="height: 400px; width: 100%" series-1-values="myPointValues" series-1-point="myPoint" time-format="ll LTS Z" timezone="{{user.getTimezone()}}" options="{legend:{}, chartCursor:{}, categoryAxis: {labelRotation:45}}"> </ma-serial-chart>
-
hi,
mango automation, i'm very new,kindly advice how to write script. -
@subakar Can you create a new thread and describe more thoroughly what you are trying to achieve.
-
Jared; Should this code also work in v3.0 I tried it in both play areas and only 2.8.8 works? Is there a different format in 3? Thanks.
maMoment is the change