How to change the activity details from months weeks to exact date and time

image
how can we change this to exact date and time


in inspect element its already showing date time but converted into days

@Mubasher You can use below script.

frappe.ui.form.on('Supplier', {
	refresh(frm) {
        var spanElement = $('.frappe-timestamp');
        var timestamp = spanElement.data('timestamp');
        spanElement.text(timestamp);
	}
});

Before :

After :

If you want you can remove time from timestamp like below ::

var datePart = timestamp.split(' ')[0];
spanElement.text(datePart);

1 Like

@Kiranmai_M Thank you for the solution

can we remove the second digits as it showing 6 digits

@Mubasher Use var datePart = timestamp.split('.')[0];

but the time stamp is stuck as shown in the image??

share your code @Mubasher

it is showing the status of document being created and for all it shows the same

in your image also its stuck just view once please

frappe.ui.form.on(‘Issue’, {
refresh(frm) {
var spanElement = $(‘.frappe-timestamp’);
var timestamp = spanElement.data(‘timestamp’);
spanElement.text(timestamp);
}
});

@Mubasher use

frappe.ui.form.on('Issue', {
	refresh(frm) {
        var spanElement = $('.frappe-timestamp');
        var timestamp = spanElement.data('timestamp');
        var datePart = timestamp.split('.')[0];
        spanElement.text(datePart);
	}
});


same date time

any solution @Kiranmai_M @NCP

@Mubasher Use

frappe.ui.form.on('Supplier', {
	refresh(frm) {
        $('.frappe-timestamp').each(function() {
            var spanElement = $(this);
            var timestamp = spanElement.data('timestamp');
            if (timestamp) {
                var datePart = timestamp.substring(0, 16);
                spanElement.text(datePart);
            }
        });
	}
});

now its working fine but 1 little issue in erp the activity is updated every 1 minute so if keep the document open more then 1 minute it will shift back to weeks and months
image
after 1 minute
image
your support is appertiated

@Mubasher this is because, we wrote that script on refresh of the doctype only

so can you provide me the code as i m not that familiar with javascript

frappe.ui.form.on('Issue', {
    refresh(frm) {
        // Run immediately once
        updateTimestamps();

        // Then run every 30 seconds
        setInterval(updateTimestamps, 30000); // 30,000ms = 30s

        function updateTimestamps() {
            $('.frappe-timestamp').each(function () {
                var $el = $(this);
                var timestamp = $el.data('timestamp');

                if (typeof timestamp === 'string') {
                    var clean = timestamp.split('.')[0]; // Remove microseconds
                    $el.text(clean);
                }
            });
        }
    }
});

i have added a time stamp to update after 30 seconds now its working fine
@Kiranmai_M thank you for your time and efforts

1 Like