Skip to content

fix(timeformat): make datetime-local inputs honor the chosen time format - #744

Open
Giorgio-Germani wants to merge 2 commits into
DRYTRIX:mainfrom
Giorgio-Germani:fix/datetime-local-time-format
Open

fix(timeformat): make datetime-local inputs honor the chosen time format#744
Giorgio-Germani wants to merge 2 commits into
DRYTRIX:mainfrom
Giorgio-Germani:fix/datetime-local-time-format

Conversation

@Giorgio-Germani

Copy link
Copy Markdown

Description

Native <input type="datetime-local"> fields (the "Forgot to end your workday?"
workday modals, the workday history filter and inline correction rows, and the
contact/deal/lead activity forms) rendered their value in the browser locale
— e.g. 08/27/2026, 05:30 PM on an English (US) browser — regardless of the
time format the user or the system settings chose. This was the one remaining
surface in the app that ignored the 24h/12h preference, because the browser
controls the display format of native datetime inputs and JavaScript/CSS cannot
change it.

The app already had a Flatpickr-based pattern (user-date-input /
user-time-input) that displays pickers in the user's resolved date + time
format while submitting unchanged wire values. This PR extends that pattern to
datetime-local inputs:

  • New user-datetime-input class is picked up by date-picker-init.js and
    replaced with a Flatpickr date-time picker (time_24hr follows the resolved
    preference, 24h by default). The submitted value stays YYYY-MM-DDTHH:MM, so
    no backend changes are needed.
  • Native min/max attributes (e.g. the auto-closed modal's latest-leave-time
    cap) are translated to Flatpickr minDate/maxDate so the hidden wire input
    can't block form submission via browser constraint validation.
  • All datetime-local inputs in the app are tagged with the new class: both
    workday modals, workday history, and the contact/deal/lead activity forms.
  • The recurring-tasks "last run" cell and the admin version-update published
    timestamp used raw toLocaleString() (browser locale) and now go through
    window.formatUserDateTime, which honors the preference.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would change existing behavior)
  • Documentation update
  • Refactor (no functional change)

Checklist

  • My code follows the project's style guidelines (Black, flake8).
  • I have added/updated tests for my changes.
  • All tests pass locally (e.g. pytest).
  • I have updated the documentation if needed.
  • For user-facing changes, I have added an entry to the Unreleased section of CHANGELOG.md.

Related issues

Fixes # (no issue filed)

Giorgio added 2 commits August 28, 2026 09:52
Native datetime-local inputs (Forgot-to-end-workday modals, workday
history corrections, contact/deal/lead activity forms) rendered in the
browser locale (12h AM/PM on en-US) regardless of the user's or system's
time format preference. They are now initialized as Flatpickr datetime
pickers (new user-datetime-input class) that display in the resolved
date + time format while submitting the same YYYY-MM-DDTHH:MM wire
value; native min/max bounds move to the picker.

Also route the recurring-tasks last-run cell and the admin version-update
published timestamp through formatUserDateTime instead of raw
toLocaleString, and add regression tests (one enforces that every
datetime-local input in the app stays prefs-aware).
…main

The branch CI failed on two issues that already exist on main, unrelated
to the time-format fix: a trailing blank line at the end of
app/routes/reports.py (flake8 W391) and four inline <script> tags without
a CSP nonce (client portal quote detail, expense approvals, project
health, utilization report). Repairs both so the pipeline is green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant