fix: formatea fechas de historial de inventario a hora local del navegador
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled

This commit is contained in:
2026-06-25 23:29:25 +00:00
parent 98e037c09a
commit d3e1660cb1
4 changed files with 14 additions and 5 deletions

View File

@@ -374,7 +374,7 @@ def get_movement_history(conn, inventory_id, limit=50):
history.append({
'id': r[0], 'type': r[1], 'quantity': r[2],
'cost': float(r[3]) if r[3] else None,
'notes': r[4], 'date': str(r[5]),
'notes': r[4], 'date': r[5].isoformat() if r[5] else None,
'employee': r[6], 'branch_id': r[7]
})
cur.close()

View File

@@ -46,6 +46,15 @@
d.textContent = s;
return d.innerHTML;
}
function formatDateTime(isoStr) {
if (!isoStr) return '-';
var d = new Date(isoStr);
if (isNaN(d.getTime())) return esc(isoStr);
return d.toLocaleString('es-MX', {
day: '2-digit', month: '2-digit', year: 'numeric',
hour: '2-digit', minute: '2-digit'
});
}
// --- Dashboard summary badges ---
function loadSummary() {
@@ -1004,7 +1013,7 @@
history.forEach(function (h) {
var qtyColor = h.quantity > 0 ? 'var(--color-success)' : 'var(--color-error)';
html += '<tr>' +
'<td style="font-size:var(--text-caption);">' + esc(h.date) + '</td>' +
'<td style="font-size:var(--text-caption);">' + formatDateTime(h.date) + '</td>' +
'<td>' + esc(h.type) + '</td>' +
'<td style="color:' + qtyColor + ';font-weight:600;">' + (h.quantity > 0 ? '+' : '') + h.quantity + '</td>' +
'<td class="td--amount">' + (h.cost ? '$' + fmt(h.cost) : '—') + '</td>' +
@@ -1828,7 +1837,7 @@
history.forEach(function (h) {
var qtyColor = h.quantity > 0 ? 'var(--color-success)' : 'var(--color-error)';
html += '<tr>' +
'<td style="font-size:var(--text-caption);">' + esc(h.date) + '</td>' +
'<td style="font-size:var(--text-caption);">' + formatDateTime(h.date) + '</td>' +
'<td>' + esc(h.type) + '</td>' +
'<td style="color:' + qtyColor + ';font-weight:600;">' + (h.quantity > 0 ? '+' : '') + h.quantity + '</td>' +
'<td class="td--amount">' + (h.cost ? '$' + fmt(h.cost) : '\u2014') + '</td>' +

View File

@@ -6,7 +6,7 @@
// The fetch handler normalizes static asset URLs (strips ?v= query strings)
// so templates can use cache-busting query params freely.
const CACHE_NAME = 'nexus-pos-v20';
const CACHE_NAME = 'nexus-pos-v21';
const APP_SHELL = [
'/pos/static/css/tokens.css',

View File

@@ -1059,7 +1059,7 @@
<script src="/pos/static/js/pos-utils.js?v=2" defer></script>
<script src="/pos/static/js/sidebar.js" defer></script>
<script src="/pos/static/js/virtual-scroll.js?v=2" defer></script>
<script src="/pos/static/js/inventory.js?v=18" defer></script>
<script src="/pos/static/js/inventory.js?v=19" defer></script>
<script src="/pos/static/js/offline-banner.js" defer></script>
<script src="/pos/static/js/sync-engine.js" defer></script>
<script>if('serviceWorker' in navigator){navigator.serviceWorker.register('/pos/sw.js',{scope:'/pos/'});}</script>