Skip to content

feat(cash): configurable business day cutoff time for cross-midnight venues #692

Closed

Description

@khaira777

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:

  1. Sales between midnight and 02:30 AM are attributed to the next calendar date rather than the current trading night.
  2. 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, default 00: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

  1. Setting: Add business_day_start_time setting (string HH:mm, default '00:00').
  2. Settings UI: Add a dropdown selector in Settings > Store Details right under Timezone with 30-minute steps between 00:00 and 11:30.
  3. Core boundary calculations:
    • Update dayBoundsInTimezone(date, timezone, startTime) in main/db.ts to shift start/end by the configured cutoff time.
    • Update localDateInTimezone(instant, timezone, startTime) to offset by startTime before resolving local calendar date.
  4. Integration:
    • main/routes/cash-closures.ts: pass configured cutoff to computeDayAggregates and date validation.
    • main/routes/reports.ts: pass cutoff to reportDayBounds and reportToday.
    • frontend/src/hooks/useCashClose.ts: resolve todayLocal accounting for the tenant's configured day start time.
  5. Historical integrity: Previously stored cash_closures rows keep their existing immutable period_start and period_end timestamps.

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.

Activity

  1. added
    enhancement
    area:frontend
    area:backend
    Ready-For-PR
    on Sep 10, 2026
  2. khaira777 commented on Sep 10, 2026

    @khaira777
    ContributorAuthor

    Work is in progress on this feature. An implementation plan is being drafted.

  3. self-assigned this
    on Sep 10, 2026
  4. khaira777 commented on Sep 10, 2026

    @khaira777
    ContributorAuthor

    completed: #695

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Ready-For-PRarea:backendarea:frontendenhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions