Fix week date range off-by-one in BST timezone
toISOString() returns UTC — in BST (UTC+1) dates computed from new Date() land one day early. Replace with local date components via fmt()/localStr(). Affects Weekly, Monthly, Rolling12Weeks, Rolling12Months. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3e1851fa6d
commit
793e97dbbb
4 changed files with 17 additions and 7 deletions
|
|
@ -6,7 +6,9 @@ import {
|
|||
import { getActuals, getNetSales, getBudgets, downloadExport } from '../api'
|
||||
import type { WageBudget } from '../types'
|
||||
|
||||
function fmt(d: Date): string { return d.toISOString().slice(0, 10) }
|
||||
function fmt(d: Date): string {
|
||||
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`
|
||||
}
|
||||
function fmtMoney(n: number): string { return `£${Math.round(n).toLocaleString('en-GB')}` }
|
||||
function pctClass(p: number): string { return p <= 100 ? 'pct-green' : p <= 110 ? 'pct-amber' : 'pct-red' }
|
||||
function daysInMonth(y: number, m: number): number { return new Date(y, m, 0).getDate() }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue