Repository navigation
Closed
Labels
Ready-For-PRTag to be used by a maintainer when an issue is approved and ready for a PRarea:backendBackend (Express/SQLite)area:frontendFrontend (React/Next.js)enhancementNew feature or request
Description
Problem or motivation
Hospitality venues such as bars, clubs, pubs, and late-night restaurants frequently operate across midnight (e.g., opening at 11:00 AM and closing at 02:30 AM the following morning).
Currently, FloCafe calculates business day boundaries strictly by calendar date from 00:00:00 to 23:59:59 tenant-local time (dayBoundsInTimezone). For a venue trading until 02:30 AM:
- Sales between midnight and 02:30 AM are attributed to the next calendar date rather than the current trading night.
- When closing the cash drawer at 02:30 AM, the Cash Close wizard assumes the operator is closing the new calendar day, while closing the previous day omits the post-midnight transactions from the Z-report snapshot and causes cash drawer count variance.
Current behavior
dayBoundsInTimezone(date, timezone) and localDateInTimezone(instant, timezone) assume a fixed 00:00:00 to 23:59:59 calendar window in tenant timezone. There is no configuration to adjust when the business day rolls over.
Desired outcome
- Operators can configure a Business Day Start Time / Cutoff (e.g.,
04:00 AM, default00:00) in Store Settings. - A business date
$D$ spans the 24-hour half-open interval from$[D\text{ at cutoff}, D+1\text{ at cutoff})$ . - At 02:30 AM on Saturday, the current business date is still Friday, and sales between midnight and 02:30 AM contribute to Friday's financial totals and Friday's End-of-Day Z-report.
- Cash Close wizard clearly indicates the period window being closed (e.g.,
2026-09-04 (04:00 to 04:00 next day)).
Proposed technical approach
- Setting: Add
business_day_start_timesetting (stringHH:mm, default'00:00'). - Settings UI: Add a dropdown selector in Settings > Store Details right under Timezone with 30-minute steps between
00:00and11:30. - Core boundary calculations:
- Update
dayBoundsInTimezone(date, timezone, startTime)inmain/db.tsto shift start/end by the configured cutoff time. - Update
localDateInTimezone(instant, timezone, startTime)to offset bystartTimebefore resolving local calendar date.
- Update
- Integration:
main/routes/cash-closures.ts: pass configured cutoff tocomputeDayAggregatesand date validation.main/routes/reports.ts: pass cutoff toreportDayBoundsandreportToday.frontend/src/hooks/useCashClose.ts: resolvetodayLocalaccounting for the tenant's configured day start time.
- Historical integrity: Previously stored
cash_closuresrows keep their existing immutableperiod_startandperiod_endtimestamps.
Alternatives considered
- Explicit Start Time and End Time window (e.g. 11:00 AM to 03:00 AM): Rejected because non-24-hour windows leave unmonitored "dead zones" (e.g. prep sales or late post-close cleanup sales) where cash and orders fall outside any business day.
- Session/Shift-based closes only (
scope='session'): While the schema supports sessions, a continuous 24-hour daily cutoff is standard across hospitality POS systems (Toast, Square, Clover) and maintains seamless daily sales reconciliation.
Metadata
Metadata
Assignees
Labels
Ready-For-PRTag to be used by a maintainer when an issue is approved and ready for a PRarea:backendBackend (Express/SQLite)area:frontendFrontend (React/Next.js)enhancementNew feature or request
Activity
khaira777 commentedon Sep 10, 2026
Work is in progress on this feature. An implementation plan is being drafted.
feat: add configurable business day cutoff times (#695)
khaira777 commentedon Sep 10, 2026
completed: #695