feat: Configurable Timeline Date Format using settings

This commit is contained in:
Vengadesh 2025-05-20 20:49:19 +05:30
parent 516836c4e5
commit 80173e9077
5 changed files with 23 additions and 5 deletions

View file

@ -61,6 +61,7 @@
"form_sidebar",
"timeline",
"dashboard",
"show_absolute_datetime_foramt",
"change_password",
"new_password",
"logout_all_sessions",
@ -827,6 +828,12 @@
"fieldname": "dashboard",
"fieldtype": "Check",
"label": "Dashboard"
},
{
"default": "0",
"fieldname": "show_absolute_datetime_foramt",
"fieldtype": "Check",
"label": "Show absolute datetime values"
}
],
"icon": "fa fa-user",
@ -885,7 +892,7 @@
}
],
"make_attachments_public": 1,
"modified": "2025-03-17 11:29:39.254304",
"modified": "2025-05-20 20:20:56.377578",
"modified_by": "Administrator",
"module": "Core",
"name": "User",

View file

@ -126,6 +126,7 @@ class User(Document):
search_bar: DF.Check
send_me_a_copy: DF.Check
send_welcome_email: DF.Check
show_absolute_datetime_foramt: DF.Check
simultaneous_sessions: DF.Int
social_logins: DF.Table[UserSocialLogin]
thread_notify: DF.Check

View file

@ -138,7 +138,13 @@ class BaseTimeline {
let timeline_content = timeline_item.find(".timeline-content");
timeline_content.append(item.content);
if (!item.hide_timestamp && !item.is_card) {
timeline_content.append(`<span> · ${comment_when(item.creation)}</span>`);
timeline_content.append(
`<span> · ${
frappe.boot.user.show_absolute_datetime_foramt === 1
? frappe.datetime.str_to_user(item.creation)
: comment_when(item.creation)
}</span>`
);
}
if (item.id) {
timeline_content.attr("id", item.id);

View file

@ -95,8 +95,9 @@ frappe.ui.form.Sidebar = class {
__("{0} created this", [get_user_link(this.frm.doc.owner)])
) +
" · " +
comment_when(this.frm.doc.creation);
(frappe.boot.user.show_absolute_datetime_foramt === 1
? frappe.datetime.str_to_user(this.frm.doc.creation)
: comment_when(this.frm.doc.creation));
let modified_message =
get_user_message(
this.frm.doc.modified_by,
@ -104,7 +105,9 @@ frappe.ui.form.Sidebar = class {
__("{0} last edited this", [get_user_link(this.frm.doc.modified_by)])
) +
" · " +
comment_when(this.frm.doc.modified);
(frappe.boot.user.show_absolute_datetime_foramt === 1
? frappe.datetime.str_to_user(this.frm.doc.modified)
: comment_when(this.frm.doc.modified));
if (user_list.length === 1) {
// same user created and edited

View file

@ -224,6 +224,7 @@ class UserPermissions:
"language",
"last_name",
"mute_sounds",
"show_absolute_datetime_foramt",
"send_me_a_copy",
"user_type",
"onboarding_status",