We have moved to GitHub Issues
Created by Sebastiaan Janssen 06 Feb 2018, 18:08:04 Updated by Jacob Midtgaard-Olesen 23 Apr 2018, 13:53:54Tags: Unscheduled
When the server time and the user's local time don't correspond, the date picker for scheduled publishing doesn't work, nor does the audit trail show dates.
== Update: A temporary fix is available using the two js files in this comment: http://issues.umbraco.org/issue/U4-10937#comment=67-44430 ==
~/umbraco/Js/umbraco.service.js replace line 9323:
dateVal = dateHelper.convertToLocalMomentTime(date, serverOffset);
dateVal = this.convertToLocalMomentTime(date, serverOffset);
The problem is that you can't use a method on a factory that you're still defining.
Here's part of the problem:
formatDatesToLocalon load (AFAIK) which formats server dates to local dates, this needs testing to make sure it's correct but the logic seems right
formatDatesToLocalis made again which is attempting to convert the user's own local date/time (non server time) to the user's local date/time ... which is calculating something that doesn't need to be done
The thing to remember is that the date/time's displayed to the user are NOT the values that are persisted to the model that is sent back to the server, however it seems that the date picker is binding to the values that are being sent back to the server. For example, the
scope.node.releaseDate is currently being updated to the date/time that the user is modifying but that is incorrect, the value that the user is modifying is their own local date/time, this then needs to be converted to the server time and stored against
The new Info tab no longer performs the necessary operations that the date picker did. The date picker was the thing that managed this before for setting scheduled published date/times. So the logic for these new date/time pickers for this tab need to adhere to the same principals that the date picker does. For example, here's the code for the date picker that sets the model value that is sent to the server: https://github.com/umbraco/Umbraco-CMS/blob/dev-v7.8/src/Umbraco.Web.UI.Client/src/views/propertyeditors/datepicker/datepicker.controller.js#L66
So it seems to me that the Info tab date pickers are binding directly to the model which is not how it is supposed to be.
To test this without worrying about setting up different servers in different timezones :P ... you can adjust the server offset time returned by Umbraco to anything you want, you can do that in the
BackOfficeServerVariables class and change the
serverTimeOffset to anything you want
I've pushed a changes which should fix this, however some testing will be needed.
For the audit trail fix, it seems that when the date is formatted as Roundtrip UTC (ISO_8601) which is the default returned from the server, when parsing with moment(date), it will automatically convert to local and then we were converting to local again, so we detect this format now and load it with moment.utc(date) so it's not mucked with and then do the conversion.
This seems to work on my tests both locally and on Cloud but testing needs to be done for:
It's almost correct now, except the scheduled publishing datepicker is still an hour of the actual picked time. See video for a better explanation.
Maybe this is intentional, we used to have this thing saying: it's scheduled for
your local time, the time on the server would be
However, then the logic is off by 2 hours, for me since the server is on UTC, 1 hour earlier than my local time. So in the video I would then expect it to show things are going to happen at 7, instead of 9 since it is currently 8 over here.
Everything should be displayed to YOU in your own local time for the audit trail and for the sheduled publishing dates, you should not see the server date/times
Just to be sure you rebuilt the client files right? but yes, i can see in the video that your picked date changes, this shouldn't be the case, the picked date should stay the date your chose obviously :P
Yep, all rebuilt, the audit trail is correct now!
For people following along, the fix Shannon added is in the attached file. It almost works now and at least it's visible what you're doing and you can work around it by fudging the time a little (the time shown after the picker closes is the actual time when the scheduled publish will happen, see screenshot, 9:36 in this case).
The final workaround, for people landing here, is to drop the attached two files in the
@warren.buckley Just want to make sure that you guys tested the normal date picker property editor too with both offsetting time enabled and disabled? (i.e. from the pre-values)
Yes just tested it with Seb now @Shandem and it works all fine
Backwards Compatible: True
Affected versions: 7.8.0
Due in version: 7.8.1
Sprint: Sprint 78
Story Points: 1