Make sure to hide the timezone offset message when no offsetting is needed (server and client are in the same timezone)
This commit is contained in:
@@ -63,7 +63,7 @@ function dateTimePickerController($scope, notificationsService, assetsService, a
|
||||
//sets the scope model value accordingly - this is the value to be sent up to the server and depends on
|
||||
// if the picker is configured to offset time. We always format the date/time in a specific format for sending
|
||||
// to the server, this is different from the format used to display the date/time.
|
||||
function setModelValue() {
|
||||
function setModelValue() {
|
||||
if ($scope.hasDatetimePickerValue) {
|
||||
var elementData = $element.find("div:first").data().DateTimePicker;
|
||||
if ($scope.model.config.pickTime) {
|
||||
@@ -95,6 +95,19 @@ function dateTimePickerController($scope, notificationsService, assetsService, a
|
||||
}
|
||||
|
||||
$scope.serverTime = null;
|
||||
$scope.serverTimeNeedsOffsetting = false;
|
||||
if (Umbraco.Sys.ServerVariables.application.serverTimeOffset !== undefined) {
|
||||
// Will return something like 120
|
||||
var serverOffset = Umbraco.Sys.ServerVariables.application.serverTimeOffset;
|
||||
|
||||
// Will return something like -120
|
||||
var localOffset = new Date().getTimezoneOffset();
|
||||
|
||||
// If these aren't equal then offsetting is needed
|
||||
// note the minus in front of serverOffset needed
|
||||
// because C# and javascript return the inverse offset
|
||||
$scope.serverTimeNeedsOffsetting = (-serverOffset !== localOffset);
|
||||
}
|
||||
|
||||
//get the current user to see if we can localize this picker
|
||||
userService.getCurrentUser().then(function (user) {
|
||||
|
||||
@@ -18,8 +18,9 @@
|
||||
<span class="help-inline" val-msg-for="datepicker" val-toggle-msg="valServer">{{datePickerForm.datepicker.errorMsg}}</span>
|
||||
<span class="help-inline" val-msg-for="datepicker" val-toggle-msg="pickerError">Invalid date</span>
|
||||
|
||||
<p ng-if="model.config.offsetTime === '1' && model.value" class="muted">
|
||||
<small>Server time: {{serverTime}}</small>
|
||||
<p ng-if="model.config.offsetTime === '1' && serverTimeNeedsOffsetting && model.value" class="muted">
|
||||
<small><localize key="content_scheduledPublishServerTime">The time you picked is your local time. This translates to the following time on the server:</localize> {{serverTime}}</small><br/>
|
||||
<small><localize key="content_scheduledPublishDocumentation">What does this mean?</localize></small>
|
||||
</p>
|
||||
<p ng-show="hasDatetimePickerValue === true || datePickerForm.datepicker.$error.pickerError === true">
|
||||
<a href ng-click="clearDate()"><i class="icon-delete"></i><small><localize key="content_removeDate">Clear date</localize></small></a>
|
||||
|
||||
@@ -169,6 +169,8 @@
|
||||
<key alias="notmemberof">Not a member of group(s)</key>
|
||||
<key alias="childItems" version="7.0">Child items</key>
|
||||
<key alias="target" version="7.0">Target</key>
|
||||
<key alias="scheduledPublishServerTime"><![CDATA[The time you picked is your local time. <br /> This translates to the following time on the server:]]></key>
|
||||
<key alias="scheduledPublishDocumentation"><![CDATA[<a href="https://our.umbraco.org/documentation/Getting-Started/Data/Scheduled-Publishing/#timezones" target="_blank">What does this mean?</a>]]></key>
|
||||
</area>
|
||||
<area alias="media">
|
||||
<key alias="clickToUpload">Click to upload</key>
|
||||
|
||||
@@ -170,6 +170,8 @@
|
||||
<key alias="notmemberof">Not a member of group(s)</key>
|
||||
<key alias="childItems" version="7.0">Child items</key>
|
||||
<key alias="target" version="7.0">Target</key>
|
||||
<key alias="scheduledPublishServerTime"><![CDATA[The time you picked is your local time. <br /> This translates to the following time on the server:]]></key>
|
||||
<key alias="scheduledPublishDocumentation"><![CDATA[<a href="https://our.umbraco.org/documentation/Getting-Started/Data/Scheduled-Publishing/#timezones" target="_blank">What does this mean?</a>]]></key>
|
||||
</area>
|
||||
<area alias="media">
|
||||
<key alias="clickToUpload">Click to upload</key>
|
||||
|
||||
Reference in New Issue
Block a user