user profile: Improve format of date type of custom fields in popover.

In user profile popover, date type of custom fields values are
not showing in correct format as "date_joined" value.
Fix this using moment.js to render date type of fields
in correct format.
This commit is contained in:
Yashashvi Dave 2018-05-27 12:25:17 +05:30 committed by Tim Abbott
parent a68ff22aed
commit 40029a0753
1 changed files with 6 additions and 1 deletions

View File

@ -179,7 +179,12 @@ function show_user_profile(element, user) {
var profile_data = {};
page_params.custom_profile_fields.forEach(function (field) {
profile_data[field.name] = people.get_custom_profile_data(user.user_id, field.id);
var field_value = people.get_custom_profile_data(user.user_id, field.id);
if (settings_profile_fields.field_type_id_to_string(field.type) === "Date") {
profile_data[field.name] = moment(field_value).format("MMMM DD YYYY");
} else {
profile_data[field.name] = field_value;
}
});
var time_preferance = people.get_user_time_preferences(user.user_id);