settings: Show the date when a user joined the realm in profile panel.

This will also help us to cover up some space when there are no custom
profile fields.
This commit is contained in:
sahil839
2021-06-30 23:18:43 +05:30
committed by Tim Abbott
parent b94d6c1a20
commit 687a4ffbb1
2 changed files with 13 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
import {parseISO} from "date-fns";
import Handlebars from "handlebars/runtime";
import $ from "jquery";
@@ -86,11 +87,18 @@ function setup_settings_label() {
};
}
function get_parsed_date_of_joining() {
const user_date_joined = people.get_by_user_id(page_params.user_id, false).date_joined;
const dateFormat = new Intl.DateTimeFormat("default", {dateStyle: "long"});
return dateFormat.format(parseISO(user_date_joined));
}
export function build_page() {
setup_settings_label();
const rendered_settings_tab = render_settings_tab({
full_name: people.my_full_name(),
date_joined_text: get_parsed_date_of_joining(),
page_params,
enable_sound_select:
page_params.enable_sounds || page_params.enable_stream_audible_notifications,