This commit is contained in:
2026-06-11 17:37:32 -05:00
parent 9985534597
commit 6ce395ecc8
3 changed files with 11 additions and 12 deletions

View File

@@ -4,11 +4,10 @@
*/ */
export function formatDate(date) { export function formatDate(date) {
const d = new Date(date); if (!date) return '—';
const month = String(d.getMonth() + 1).padStart(2, '0'); const parts = String(date).split('T')[0].split('-');
const day = String(d.getDate()).padStart(2, '0'); if (parts.length !== 3) return String(date);
const year = d.getFullYear(); return `${parts[1]}/${parts[2]}/${parts[0]}`;
return `${month}/${day}/${year}`;
} }
export function setDefaultDate() { export function setDefaultDate() {

View File

@@ -881,7 +881,8 @@ function renderTaxPeriodsTable() {
else if (pStatus === 'external' || pStatus === 'paid') { statusHtml = 'Paid'; statusColor = 'bg-green-100 text-green-800'; } else if (pStatus === 'external' || pStatus === 'paid') { statusHtml = 'Paid'; statusColor = 'bg-green-100 text-green-800'; }
else { statusHtml = 'Open'; statusColor = 'bg-yellow-100 text-yellow-800'; } else { statusHtml = 'Open'; statusColor = 'bg-yellow-100 text-yellow-800'; }
const monthLabel = new Date(p.period_start).toLocaleDateString('en-US', { year: 'numeric', month: 'long' }); const [py, pm] = String(p.period_start).split('T')[0].split('-');
const monthLabel = new Date(Number(py), Number(pm) - 1).toLocaleDateString('en-US', { year: 'numeric', month: 'long', timeZone: 'UTC' });
const adj = parseFloat(p.adjustment_amount) || 0; const adj = parseFloat(p.adjustment_amount) || 0;
const adjStr = adj !== 0 ? (adj > 0 ? `$${adj.toFixed(2)}` : `+$${Math.abs(adj).toFixed(2)}`) : '—'; const adjStr = adj !== 0 ? (adj > 0 ? `$${adj.toFixed(2)}` : `+$${Math.abs(adj).toFixed(2)}`) : '—';
const netPaid = parseFloat(p.net_paid) || parseFloat(p.tax_collected) || 0; const netPaid = parseFloat(p.net_paid) || parseFloat(p.tax_collected) || 0;
@@ -970,7 +971,7 @@ async function openTaxPeriodDetail(startDate, endDate, existingPeriod) {
const today = todayISO(); const today = todayISO();
const [y, m] = startDate.split('-').map(Number); const [y, m] = startDate.split('-').map(Number);
const monthLabel = new Date(y, m - 1).toLocaleDateString('en-US', { year: 'numeric', month: 'long' }); const monthLabel = new Date(y, m - 1).toLocaleDateString('en-US', { year: 'numeric', month: 'long', timeZone: 'UTC' });
detailEl.innerHTML = ` detailEl.innerHTML = `
<div class="bg-white rounded-lg shadow-sm border border-gray-200 p-4"> <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-4">

View File

@@ -3,11 +3,10 @@
*/ */
function formatDate(date) { function formatDate(date) {
const d = new Date(date); if (!date) return '—';
const month = String(d.getMonth() + 1).padStart(2, '0'); const parts = String(date).split('T')[0].split('-');
const day = String(d.getDate()).padStart(2, '0'); if (parts.length !== 3) return String(date);
const year = d.getFullYear(); return `${parts[1]}/${parts[2]}/${parts[0]}`;
return `${month}/${day}/${year}`;
} }
function formatMoney(val) { function formatMoney(val) {