Repository navigation
fix: use tenant timezone for reports and printing - #619
Merged
Merged
Conversation
Contributor
Greptile SummaryThe PR makes print timestamps and report calendar boundaries use the tenant-configured timezone.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| main/db.ts | Adds tenant-local date resolution and DST-aware conversion of local calendar-day boundaries into UTC ranges. |
| main/routes/reports.ts | Applies tenant-local defaults, filtering boundaries, and daily grouping throughout reporting endpoints. |
| main/routes/printers.ts | Propagates the configured tenant timezone into printer tests and bill rendering. |
| main/printers/thermal.ts | Uses the authoritative timezone setting for KOT and test-page timestamp formatting. |
| frontend/src/app/(dashboard)/print-test/page.tsx | Builds frontend print-test tenant data with the authenticated tenant timezone. |
| tests/timezone-report-boundaries.test.ts | Adds regression coverage for tenant-local reporting boundaries across UTC and positive and negative offsets. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Tenant timezone setting] --> B[Print contexts]
A --> C[Tenant-local report date]
B --> D[Receipt / KOT / compliance / test output]
C --> E[UTC half-open database range]
E --> F[Filtered report rows]
F --> G[Tenant-local daily grouping]
Reviews (2): Last reviewed commit: "no-mistakes(ci): Fixed the PR-induced te..." | Re-trigger Greptile
…configuring UTC for UTC-based report fixtures in tests/refunds.test.ts and tests/issue-214-payment-integrity.test.ts. Verified: refunds 54/54 passed, issue-214 83/83 passed, neighboring report/timezone suites passed, and git diff --check passed
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Implement Phase 4 of the FloCafe internationalization and printing remediation plan: make store-authoritative timezone behavior consistent across print and reporting paths. Reproduce the current behavior before editing. Replace the KOT settings-row timezone query with the key/value lookup used by the rest of the application. Propagate the tenant/store timezone through backend receipt, KOT, compliance, and print-test contexts. Reconcile report day boundaries with the tenant-local dashboard day. Add fixed-instant regression tests covering UTC, positive offsets, and negative offsets around midnight. Acceptance criteria: KOT settings read the same authoritative timezone source used elsewhere; receipt, KOT, compliance, and print-test output use the tenant timezone consistently; report day boundaries agree with the tenant-local dashboard day around midnight; tests cover UTC, positive offsets, negative offsets, and boundary instants, with the narrowest relevant existing suites passing; existing print semantics and prior Phase 1-3 financial, thermal-safety, locale, and metadata behavior remain unchanged. Keep this as a timezone-only change. Do not alter locale selection or bootstrap, currency precision or regional currency modeling, tax or service-charge policy, country-pack templates, printer capability architecture, raster output, broad routing, or unrelated UI. Start from the current FloCafe default branch after merged PR #615. Phase 5A country-pack charge-row parity remains separately deferred until its output-contract compatibility decision is settled.
What Changed
Risk Assessment
✅ Low: The focused timezone changes are source-consistent and no material defect or intent contradiction was substantiated.
Testing
Installed locked dependencies, ran the narrow timezone/report/print suites, and exercised fixed-instant print plus tenant-midnight report API behavior; all targeted checks passed, temporary fixtures were cleaned, and no UI screenshot was captured because the change affects print output and backend reporting rather than visual layout.
Evidence: Tenant-local print output transcript
Evidence: Tenant-local report API transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
npm run test:timezone-report-boundariesnpm run test:reports-insightsnpm run test:reports-daily-stats-table-turnnpm run test:print-paritynpm run test:print-documentnpm run test:printernpm run test:receipt-printingnpm run test:bills-print-apinpm run test:print-labelsnpm run test:i18n-ssr-timezonenpm run test:kot-locale-cold-startnpm run test:issue-389-timezone-overrideFixed-instant receipt/KOT/printer-test rendering checksFixed-boundary/api/reports/summary,/sales, and/recentOrderschecksgit diff --checkand finalgit status✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.