Timestamp format

Hi,
ERPNext shows timestamp as “7hours ago”, “1 week ago” … is it possible to instead have it show the exact date and time of the activity

1 Like

Hi @usmanalikhan,

for a one doctype, then is possible :sweat_smile:

Please apply the client script. Here i applied for customer.

frappe.ui.form.on('Customer', {
    refresh: function(frm) {
        var timestamps = $(".frappe-timestamp");
        timestamps.each(function(index, element) {
            var timestamp = $(element).data("timestamp");
            $(element).text(timestamp);
        });
    }
});

Output:

I hope this helps.

Thank You!

1 Like

Thank you!!!

Is there any way to apply this across all docs?

You have to check it in the core file where is it defined.

Hi @usmanalikhan,

Please check it.

$(document).on('app_ready', function() {
	$.each(["Opportunity", "Quotation", "Supplier Quotation", 
		"Sales Invoice", "Delivery Note",  "Sales Order",
		"Purchase Invoice", "Purchase Receipt", "Purchase Order"], function(i, doctype) {
			frappe.ui.form.on(doctype, {
				refresh: function(frm) {
					var timestamps = $(".frappe-timestamp");
					timestamps.each(function(index, element) {
						var timestamp = $(element).data("timestamp");
						$(element).text(timestamp);
					});
				}
			});
	});
});
3 Likes

Thanks!!! this was very helpful!