date fix
This commit is contained in:
@@ -4,11 +4,10 @@
|
||||
*/
|
||||
|
||||
export function formatDate(date) {
|
||||
const d = new Date(date);
|
||||
const month = String(d.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(d.getDate()).padStart(2, '0');
|
||||
const year = d.getFullYear();
|
||||
return `${month}/${day}/${year}`;
|
||||
if (!date) return '—';
|
||||
const parts = String(date).split('T')[0].split('-');
|
||||
if (parts.length !== 3) return String(date);
|
||||
return `${parts[1]}/${parts[2]}/${parts[0]}`;
|
||||
}
|
||||
|
||||
export function setDefaultDate() {
|
||||
|
||||
@@ -881,7 +881,8 @@ function renderTaxPeriodsTable() {
|
||||
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'; }
|
||||
|
||||
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 adjStr = adj !== 0 ? (adj > 0 ? `−$${adj.toFixed(2)}` : `+$${Math.abs(adj).toFixed(2)}`) : '—';
|
||||
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 [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 = `
|
||||
<div class="bg-white rounded-lg shadow-sm border border-gray-200 p-4">
|
||||
|
||||
Reference in New Issue
Block a user