15209 media picker shows incorrect date (#15414)
* Trim update date to exclude Z character. When picking media, the items from an SQL database contain an update date that is formated in UTC-0 time by way of a Z character at the end of the string. Removing this string will result in the update date always displaying local time as expected. Issue: 15209 * Use dateHelper instead of slicing Z from date string. For most front end date formatting, dateHelper is used to get the local date. The dateHelper is now passed in to the media picker controller and used to format the date.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//used for the media picker dialog
|
||||
angular.module("umbraco")
|
||||
.controller("Umbraco.Editors.MediaPickerController",
|
||||
function ($scope, $timeout, mediaResource, entityResource, userService, mediaHelper, mediaTypeHelper, eventsService, treeService, localStorageService, localizationService, editorService, umbSessionStorage, notificationsService, clipboardService) {
|
||||
function ($scope, $timeout, mediaResource, entityResource, userService, mediaHelper, mediaTypeHelper, eventsService, treeService, localStorageService, localizationService, dateHelper, editorService, umbSessionStorage, notificationsService, clipboardService) {
|
||||
|
||||
var vm = this;
|
||||
|
||||
@@ -575,9 +575,12 @@ angular.module("umbraco")
|
||||
if (item.metaData.MediaPath !== null) {
|
||||
item.thumbnail = mediaHelper.resolveFileFromEntity(item, true);
|
||||
item.image = mediaHelper.resolveFileFromEntity(item, false);
|
||||
}
|
||||
if (item.metaData.UpdateDate !== null) {
|
||||
item.updateDate = item.metaData.UpdateDate;
|
||||
}
|
||||
if (item.metaData.UpdateDate !== null) {
|
||||
userService.getCurrentUser().then(currentUser => {
|
||||
item.updateDate = dateHelper.getLocalDate(item.metaData.UpdateDate, currentUser.locale, "LLL");
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user