"use client"; import {usePathname,useRouter,useSearchParams} from 'next/navigation'; import {useTransition} from 'react'; export function InvoiceMonthFilter({selected,current,periods}:{selected:string;current:string;periods:string[]}){ const router=useRouter(),path=usePathname(),params=useSearchParams(); const [pending,startTransition]=useTransition(); const change=(value:string)=>{const query=new URLSearchParams(params.toString());query.set('month',value);startTransition(()=>router.push(`${path}?${query}`));}; const label=(period:string)=>new Date(`${period}-01T12:00:00Z`).toLocaleDateString('en-ZA',{month:'long',year:'numeric',timeZone:'Africa/Johannesburg'}); return

{pending?'Updating invoices…':'Totals and booking status follow the selected month.'}

; }