Skip to content

Commit

Permalink
Rollback dropdown - convert version dates to local
Browse files Browse the repository at this point in the history
  • Loading branch information
stevemegson authored and nul800sebastiaan committed Oct 29, 2019
1 parent 6c13e4a commit 0554b47
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function () {
"use strict";

function RollbackController($scope, contentResource, localizationService, assetsService) {
function RollbackController($scope, contentResource, localizationService, assetsService, dateHelper, userService) {

var vm = this;

Expand Down Expand Up @@ -90,11 +90,15 @@
const culture = $scope.model.node.variants.length > 1 ? vm.currentVersion.language.culture : null;

return contentResource.getRollbackVersions(nodeId, culture)
.then(function(data){
vm.previousVersions = data.map(version => {
version.displayValue = version.versionDate + " - " + version.versionAuthorName;
return version;
});
.then(function (data) {
// get current backoffice user and format dates
userService.getCurrentUser().then(function (currentUser) {
vm.previousVersions = data.map(version => {
var timestampFormatted = dateHelper.getLocalDate(version.versionDate, currentUser.locale, 'LLL');
version.displayValue = timestampFormatted + ' - ' + version.versionAuthorName;
return version;
});
});
});
}

Expand Down

0 comments on commit 0554b47

Please sign in to comment.