Engineering
Why Time Rounding Starts Off — And Why We Never Overwrite the Original Minutes
Time rounding is a billing rule, not a stopwatch. MinuteShark ships with it off because a freelancer’s first week should show what actually happened — ten minutes of a hotfix, thirteen minutes of a standup — before anyone asks the clock to speak in tenths of an hour.
When you do turn rounding on, the original duration stays. Reports, History, trackers, and invoices can show a BILLABLE number. The stored entry does not get rewritten to match the invoice. That split is the product. This post is how we built it on Ionic, Angular 16, and Firebase — and why “just mutate the minutes” would have been a shorter function and a worse timesheet.
The rule we shipped: rounding is off until you choose it. It rounds up. Presets are 6 minutes (0.1 hour), 15, 30, or a custom interval. The original duration is always stored. The rounded value is a BILLABLE view that flows into reports, History, trackers, and invoices — not a silent edit of the past.
Why the default is off
Enterprise timesheets often arrive pre-rounded because a department already agreed on tenths. Freelancers and consultants usually have not. They are still learning whether the week is 28 honest hours or 28 hours plus a rounding story they cannot defend yet.
If we had shipped 6-minute rounding as the default, the first History screen would have lied in a friendly way. Ten minutes of a login bug would have shown as twelve. Thirteen minutes of a call would have shown as eighteen. That is correct billing once you have a rate card and a client who expects tenths. It is a bad teacher on day one.
Off-by-default also matches how people actually adopt the product. Add a client, a project, a task, start the timer. See today. Then decide whether BILLABLE should round up. The time rounding guide is the source of truth for the arithmetic. This post is the storage decision underneath it.
Two numbers, one entry
A time entry is a fact: this person, this task, this start, this end (or this manual duration). Rounding is a policy applied at read time for money-adjacent surfaces. We do not replace the fact with the policy.
That sounds obvious until you implement it the lazy way. The lazy way writes the rounded minutes back to Firestore so every query is simple. Then someone turns rounding off, or changes 6 minutes to 15, or asks “what did I actually work on Thursday?” and the original 10-minute hotfix is gone. You cannot audit a number you overwrote.
So the document keeps the original duration. Ionic + Angular 16 views decide whether to show raw minutes, a BILLABLE badge, or both. History defaults to today and can show BILLABLE when rounding is on — a view, not a rewrite. Reports generate a grand total and, if rounding is on, a rounded billable total from the same What × Who × When query. Chart.js draws the thinking surface. The Firestore documents stay stubborn.
The 6-minute examples we actually use
- 10 minutes → 12. One increment up. The stored entry is still 10.
- 13 minutes → 18. Still one increment up from 12. Not “close enough to 15, leave it.”
- Always up. We do not round to nearest. Nearest is how a 4-minute ping disappears from an invoice and then from your memory of the week.
- Custom is still a policy. A 6-, 15-, or 30-minute preset, or your own interval, is a named rule on the workspace — not an AI improvisation on a single card.
If you need the client-facing script for tenths of an hour, that already lives in how to explain 6-minute rounding without sounding like you are padding. This piece is the opposite direction: why the database refuses to forget the 10.
Where the rounded number is allowed to appear
Once rounding is on, BILLABLE is not a second timesheet. It is the same entries, read through the policy, in four places that already share a cost story:
- History. You can still edit start and end. The original duration remains the source. The badge is a warning label: “this is what invoices will see.”
- Reports. Grand total plus rounded billable total. Pivot by date, client, project, task, user, or team. Export CSV, Excel, or JSON from the same query — the export is a dump of the generate step, not a screenshot of the chart.
- Trackers. A tracker watches one project or one task against an estimate, a budget, or a revenue goal. It should consume the same rounded truth invoices will use, or the 50% email is theater.
- Invoices. Generate Invoice from the report, pick a cost profile, and the line items inherit the billable minutes. The PDF is allowed to speak in tenths. The entry that created those tenths is still 10 minutes in the log.
Midnight is the nasty seam. An entry that starts late Thursday and ends Friday morning still “belongs” to the When range it started in for rounded totals. We include the full rounded value for those entries rather than splitting a policy across two civil dates. Consultants already hate fake two-day rows. We were not going to invent a third kind of lie at 12:01 a.m.
What we refused to automate
MinuteShark AI can log forgotten time, edit an entry, or open a filtered report. It does not silently round a duration to make a sentence tidier. Rounding is a workspace setting a human turns on. The assistant proposes mutations; you confirm a card. A confirmation card that said “I helpfully made your 13 minutes into 18” would be a write we do not want, even if you could revert it.
We also do not invent idle time so a 10-minute session becomes a “nice” 12 before the policy runs. No screenshot story. No keystroke padding. The increment is arithmetic on a duration you already accepted.
Permissions stay boring. Changing rounding is a settings concern, not a Regular User improvisation in chat. The same Admin who owns cost profiles owns the money-adjacent rules. That is not an org chart. It is one person who should not be surprised by Friday’s PDF.
How we test it (without a billing beauty contest)
Useful checks are product tests that happen to touch Firebase:
- With rounding off, History and a report show 10 minutes for a 10-minute entry — no badge theater.
- With 6-minute rounding on, the same document still stores 10, History can show BILLABLE 12, and an invoice line can bill 12.
- Turn rounding off again. Thursday’s hotfix is still 10. The 12 was never the source of truth.
- Change 6 minutes to 15. Re-read. The policy changes; the documents do not need a migration.
- An entry that starts in range and crosses midnight contributes its full rounded value to that range’s billable total.
Those tests are why we kept the stack boring: Ionic + Angular 16 for the keyboard-first views, Firebase Auth and Firestore for the entry that both devices must agree on, Chart.js for the report you think with, jsPDF / docx / xlsx for the document you send. The increment math is small. The refusal to overwrite is the feature.
What this means if you are building a billing clock
If a number can appear on a PDF, store the observation and the policy separately. Default the policy off until the user has a reason. Round in one direction and write the examples down. Let reports, invoices, and budget alerts share the policy so Friday is not a scavenger hunt. Do not let an assistant “clean up” the observation.
MinuteShark AI is included on every plan. Rounding is included too. We would rather you spend a week looking at raw minutes than spend a quarter explaining why every hotfix is a neat multiple of six. The reports guide is where the What × Who × When generate step meets those two totals. The clock stays honest either way.