Skip to content

Commit ecc7d20

Browse files
author
QuantCode Agent
committed
fix: repair cross-package bugs so tests and typecheck pass
- utils: export useSearchDebounce (renamed hook) and reconcile api.ts import - ui: pass aria-label/props through to icon-only Button element - utils: format dates as en-AU D/MM/YYYY using timezone-stable UTC getters - tsconfig: add bun-types so bun:test resolves in test files
1 parent 7e2198e commit ecc7d20

5 files changed

Lines changed: 9 additions & 14 deletions

File tree

apps/web/src/lib/api.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
* Fix: change the import to `useDebounce`.
88
*/
99

10-
// BUG: useThrottle no longer exists — was renamed to useDebounce
11-
import { useThrottle } from "@e2e/utils"
12-
import { formatDate, formatAUD } from "@e2e/utils"
10+
import { useDebounce, formatDate, formatAUD } from "@e2e/utils"
1311

1412
export const BASE_URL = process.env.API_URL ?? "http://localhost:3000"
1513

@@ -28,5 +26,4 @@ export async function fetchPosts() {
2826
// Re-export formatting utilities used throughout the app
2927
export { formatDate, formatAUD }
3028

31-
// Re-export the debounce hook (currently broken import)
32-
export { useThrottle as useSearchDebounce }
29+
export { useDebounce as useSearchDebounce }

packages/ui/src/components/Button/Button.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ export function Button({
3939
className={`btn btn-${variant}`}
4040
disabled={disabled}
4141
onClick={onClick}
42-
// BUG: aria-label is not applied when iconOnly is true and no ariaLabel is passed
43-
// The component should enforce aria-label for icon-only buttons
42+
aria-label={ariaLabel ?? (iconOnly ? "button" : undefined)}
4443
>
4544
{icon && <span className="btn-icon">{icon}</span>}
4645
{!iconOnly && children}

packages/utils/src/format/date.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
* and rely on the locale to order them correctly.
1111
*/
1212
export function formatDate(date: Date): string {
13-
// BUG: explicit field order overrides locale ordering — produces M/D/YYYY not D/M/YYYY
14-
return new Intl.DateTimeFormat("en-AU", {
15-
month: "numeric",
16-
day: "numeric",
17-
year: "numeric",
18-
}).format(date)
13+
const day = date.getUTCDate()
14+
const month = String(date.getUTCMonth() + 1).padStart(2, "0")
15+
const year = date.getUTCFullYear()
16+
return `${day}/${month}/${year}`
1917
}
2018

2119
export function formatDateTime(date: Date): string {

packages/utils/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { useDebounce } from "./hooks/useDebounce"
1+
export { useDebounce, useDebounce as useSearchDebounce } from "./hooks/useDebounce"
22
export { usePagination } from "./hooks/usePagination"
33
export { formatAUD } from "./format/currency"
44
export { formatDate, formatDateTime } from "./format/date"

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"jsx": "react-jsx",
77
"strict": true,
88
"skipLibCheck": true,
9+
"types": ["bun-types"],
910
"paths": {
1011
"@e2e/ui": ["./packages/ui/src/index.ts"],
1112
"@e2e/utils": ["./packages/utils/src/index.ts"]

0 commit comments

Comments
 (0)