diff --git a/src/lib/invoice-generation.ts b/src/lib/invoice-generation.ts index 448efc6..b7c9eac 100644 --- a/src/lib/invoice-generation.ts +++ b/src/lib/invoice-generation.ts @@ -15,11 +15,12 @@ export interface GenerateInvoiceResult { invoiceNumber: string; } -// Round hours to the nearest 0.6 (per firm policy: tenths of an hour rounded -// up to the nearest 6-minute increment, capped at a 0.6h granularity). +// Round hours UP to the nearest 0.1 (6-minute increment), per firm policy: +// any time worked is billed in 6-minute units, with a 0.1h minimum. export function roundHoursToSixTenths(hours: number): number { const n = Math.max(0, Number(hours) || 0); - return +(Math.round(n / 0.6) * 0.6).toFixed(2); + if (n === 0) return 0; + return +(Math.max(0.1, Math.ceil(n / 0.1) * 0.1)).toFixed(2); } export async function generateInvoiceForClient(args: GenerateInvoiceArgs): Promise {