Repository navigation
Run the backend in UTC and take the hotel's dates and times from Madrid - #31
Merged
Merged
Conversation
- Set TZ=UTC first thing in index.ts: Render already ran in UTC, but a machine in Madrid read every DATE one day early and each edit moved it. - Read and write dates in UTC in mysql2 and set time_zone to UTC on every MySQL connection, as Aiven already is, so NOW() and CURRENT_TIMESTAMP mean the same everywhere. - Run the tests in UTC on any machine. - Record the decision as ADR-047.
- Replace CURDATE() and NOW() with Madrid's date and time, built in Node and inlined as literals (repositories/shared/hotel-clock.ts): between 00:00 and 02:00 in Madrid the UTC date was still yesterday in parking filters, group arrivals, group payments and overdue invoices. - Treat parking check-in/out times as the hotel's wall clock: they were stored as typed but read back as UTC, so the screens showed every booking two hours late and each edit moved it two more. The API now answers them without Z, and the default times are Madrid's. - Take the maintenance report prefix, the activity range, the backoffice ZIP name and the batch payment's default month from Madrid's date. - Date the parking booking code in Madrid (20261014_booking_code_hotel_date.sql, applied on local and Aiven). - Test the helpers at 00:30 in Madrid, summer and winter.
- Replace DATE(column) on UTC timestamps with the column's Madrid date (sqlMadridDay, CONVERT_TZ to Europe/Madrid): an action at 00:30 in Madrid was listed under the day before in the cashier history and vouchers, the activity feed, logbooks without a date, maintenance reports, parking stats and the demo activity log. - Fall back to the UTC date where MySQL has no named time zones (a local install), as before; Aiven has them.
- Replace new Date().toISOString() as "today" with getMadridDate(): between 00:00 and 02:00 in Madrid it gave yesterday as the default date of a new invoice, the cashier log day, the parking edit form and the blacklist form, and in the names of the CSV and ZIP exports.
- Store a changed date as plain ISO text: JSON.stringify quoted it, and the history tab parsed the quoted string as an object and listed one change per character. - Compare field by field only when both values are records, and strip the quotes of the rows already stored, so old entries read as dates too. - Show history times and dates in Madrid time.
- Maintenance history: statuses and priorities through their translations, and the assignee by name (the API now joins the user of an assignment) instead of in_progress or a user id. - Cashier history: shift and voucher statuses translated, and dates and times fixed to Madrid. - Blacklist audit trail: dates fixed to Madrid.
- The regex lost its backslash and never matched, so in_progress stayed untranslated.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
bpstack
added a commit
that referenced
this pull request
Oct 14, 2026
This branch was successfully deployed
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.
Changes
DATEone day early and each edit moved it.CURDATE(),NOW(),DATE(timestamp)andtoISOString()gave yesterday between 00:00 and 02:00 in Madrid (parking filters and stats, group arrivals and payments, overdue invoices, cashier history and vouchers, activity, logbook, maintenance). They now use Madrid's date, built in Node or withCONVERT_TZ.Z.20261014_booking_code_hotel_date.sql, applied on local and Aiven).getMadridDate()instead of the UTC date (new invoice, cashier log day, parking edit, blacklist, export names).Checked
pnpm verifyin backend (1532 tests) and frontend; backend tests without a database, as CI runs them. Helpers tested at 00:30 in Madrid, summer and winter.