UserController should use getLocalDate from dateHelper (#13469)
* Use `getLocalDate` from dateHelper
* Remove duplicate import
* Keep function getLocalDate but use dateHelper
* Mark function as deprecated
(cherry picked from commit 30a7bca0ef)
This commit is contained in:
committed by
Sebastiaan Janssen
parent
77fdcf20ca
commit
aaababca9b
@@ -109,22 +109,15 @@
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @function
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
function getLocalDate(date, culture, format) {
|
||||
if (date) {
|
||||
var dateVal;
|
||||
var serverOffset = Umbraco.Sys.ServerVariables.application.serverTimeOffset;
|
||||
var localOffset = new Date().getTimezoneOffset();
|
||||
var serverTimeNeedsOffsetting = (-serverOffset !== localOffset);
|
||||
|
||||
if (serverTimeNeedsOffsetting) {
|
||||
dateVal = dateHelper.convertToLocalMomentTime(date, serverOffset);
|
||||
} else {
|
||||
dateVal = moment(date, "YYYY-MM-DD HH:mm:ss");
|
||||
}
|
||||
|
||||
return dateVal.locale(culture).format(format);
|
||||
}
|
||||
return dateHelper.getLocaleDate(date, culture, format);
|
||||
}
|
||||
|
||||
function toggleChangePassword() {
|
||||
@@ -571,11 +564,11 @@
|
||||
userService.getCurrentUser().then(function (currentUser) {
|
||||
currentLoggedInUser = currentUser;
|
||||
|
||||
user.formattedLastLogin = getLocalDate(user.lastLoginDate, currentUser.locale, "LLL");
|
||||
user.formattedLastLockoutDate = getLocalDate(user.lastLockoutDate, currentUser.locale, "LLL");
|
||||
user.formattedCreateDate = getLocalDate(user.createDate, currentUser.locale, "LLL");
|
||||
user.formattedUpdateDate = getLocalDate(user.updateDate, currentUser.locale, "LLL");
|
||||
user.formattedLastPasswordChangeDate = getLocalDate(user.lastPasswordChangeDate, currentUser.locale, "LLL");
|
||||
user.formattedLastLogin = dateHelper.getLocalDate(user.lastLoginDate, currentUser.locale, "LLL");
|
||||
user.formattedLastLockoutDate = dateHelper.getLocalDate(user.lastLockoutDate, currentUser.locale, "LLL");
|
||||
user.formattedCreateDate = dateHelper.getLocalDate(user.createDate, currentUser.locale, "LLL");
|
||||
user.formattedUpdateDate = dateHelper.getLocalDate(user.updateDate, currentUser.locale, "LLL");
|
||||
user.formattedLastPasswordChangeDate = dateHelper.getLocalDate(user.lastPasswordChangeDate, currentUser.locale, "LLL");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user