how can we change this to exact date and time
@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);
can we remove the second digits as it showing 6 digits
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);
}
});
@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
after 1 minute
your support is appertiated
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