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 Handlebars from "handlebars/runtime";
import $ from "jquery"; 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() { export function build_page() {
setup_settings_label(); setup_settings_label();
const rendered_settings_tab = render_settings_tab({ const rendered_settings_tab = render_settings_tab({
full_name: people.my_full_name(), full_name: people.my_full_name(),
date_joined_text: get_parsed_date_of_joining(),
page_params, page_params,
enable_sound_select: enable_sound_select:
page_params.enable_sounds || page_params.enable_stream_audible_notifications, page_params.enable_sounds || page_params.enable_stream_audible_notifications,

View File

@@ -18,6 +18,11 @@
</div> </div>
</div> </div>
</form> </form>
<div class="input-group grid">
<span class="title">{{t "Joined" }}: {{date_joined_text}}</span>
</div>
<form class="form-horizontal timezone-setting-form"> <form class="form-horizontal timezone-setting-form">
<div class="input-group grid"> <div class="input-group grid">
<label for="timezone" class="dropdown-title inline-block">{{t "Time zone" }}</label> <label for="timezone" class="dropdown-title inline-block">{{t "Time zone" }}</label>