Skip to content

feat(forms): time segments for DateInput and DatePicker - #617

Merged
josemarluedke merged 2 commits into
josemarluedke:mainfrom
MichalBryxi:feat/date-time-granularity
Oct 14, 2026
Merged

josemarluedke merged 2 commits into
josemarluedke:mainfrom
MichalBryxi:feat/date-time-granularity

Conversation

@MichalBryxi

Copy link
Copy Markdown
Contributor

Summary

Adds time entry to DateInput and DatePicker, as proposed in #616.

  • @granularity: 'day' (the default, unchanged), 'hour' or 'minute'. The time segments come from Intl.DateTimeFormat.formatToParts, like the date ones, so their order and separators follow the locale.
  • @hourCycle: 12 | 24, defaulting to the locale. The hour segment's bounds follow the cycle Intl resolves (h11/h12/h23/h24). A 12-hour cycle adds an AM/PM segment (dayPeriod) with the locale's labels. It's typed by its first letter, stepped with the arrows, and announced by name through aria-valuetext.
  • Value: still a Date, now with the time. The hidden input submits the local yyyy-MM-ddTHH:mm (the datetime-local shape), and @value / parseDate accept it, so a value round-trips through form data with no time-zone conversion. toWire takes the granularity.
  • Calendar: a day picked in the calendar keeps the time the field shows (typed before or after the day), or starts at midnight. Each end of a range keeps its own time. Footer presets still set their value as given.
  • Button trigger: defaults to { dateStyle: 'medium', timeStyle: 'short' } when there's a time.
  • Paste: ISO date-times (T or a space), AM/PM read from the text (PM, a.m.), and a 24-hour time pasted into a 12-hour field lands on the right side of noon. An ISO date alone still fills the date and leaves the time.
  • Test support: fillDate / fillDateRange accept yyyy-MM-ddTHH:mm and type the time. The hour goes in on the field's own clock, read from the spinbutton bounds, and AM/PM is set by stepping, so the helpers don't depend on the locale's labels.
  • Docs: a Time section on both pages, plus the anatomy, accessibility, forms and testing sections.

The exported segment helpers keep their signatures: buildParts and emptySegment gain optional parameters, and seedFrom was internal.

Closes #616.

Out of scope

Seconds, and time zones: the value is a local wall-clock time, like datetime-local's.

Test plan

  • New unit tests (date-input-time-test.ts): segment order per locale, hour bounds per cycle, @hourCycle overrides, typing, AM/PM by letter and by arrow, round-trips including noon and midnight, paste, parseDate / toWire.
  • New integration tests (date-time-test.gts): DateInput and DatePicker with a time, AM/PM typing, a 24-hour locale, Form round-trips for a single field and a range, calendar picks keeping the typed time or starting at midnight, and the button trigger's default format.
  • Full suite: 2,219 pass, 3 skipped, 0 failures.
  • eslint, prettier, ember-template-lint and ember-tsc on the package pass. lint:anatomy reports two orphan parts in segment-group.gts, which main reports too.
  • Not yet checked by eye in the docs site (segment widths, the AM/PM segment's look).

🤖 Generated with Claude Code

https://claude.ai/code/session_01R3mA4zgRstPD9uLyJut5Nn

@netlify

netlify Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for frontile-next ready!

Name Link
🔨 Latest commit 92ca635
🔍 Latest deploy log https://app.netlify.com/projects/frontile-next/deploys/6acf0408c7a4d8c40a73ac7b
😎 Deploy Preview https://deploy-preview-617--frontile-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@josemarluedke

Copy link
Copy Markdown
Owner

This is looking good. I would just remove the comma between the date and the time, as that is not usual.

image

@josemarluedke josemarluedke added the Type: Enhancement New feature or request label Oct 13, 2026
MichalBryxi and others added 2 commits October 14, 2026 06:19
`@granularity` ('day' by default, 'hour' or 'minute') adds hour and minute
segments after the date ones, ordered and separated by the locale like the
date segments. A 12-hour clock adds an AM/PM segment, typed by its first
letter and stepped with the arrows; `@hourCycle` forces 12 or 24.

The value stays a Date, now carrying the time, and the field submits and
accepts the local `yyyy-MM-ddTHH:mm` that datetime-local uses, so it
round-trips through form data with no time-zone conversion. Picking a day
in the calendar keeps the time the field shows (each end of a range its
own) or starts at midnight. The button trigger adds `timeStyle: 'short'`
by default. Paste reads ISO date-times, AM/PM words, and a 24-hour time
into a 12-hour field; fillDate and fillDateRange type the time too.

Closes josemarluedke#616

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R3mA4zgRstPD9uLyJut5Nn
Intl joins them with one in many locales (01/20/2026, 09:05 PM). The
literal between the last date segment and the first time segment now
drops it, keeping whatever else the locale put there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WkpExUYSun56aYFoHVcjJC
@MichalBryxi
MichalBryxi force-pushed the feat/date-time-granularity branch from 2df6515 to 92ca635 Compare October 14, 2026 04:24
@MichalBryxi

Copy link
Copy Markdown
Contributor Author

Done in 92ca635: the literal between the date and the time drops the comma (01/20/2026 09:05 PM, 20/01/2026 21:05), keeping the rest of what the locale puts there. Copy-to-clipboard follows what's shown. Also rebased on main.

@josemarluedke
josemarluedke marked this pull request as ready for review October 14, 2026 15:53
@josemarluedke
josemarluedke merged commit 3802546 into josemarluedke:main Oct 14, 2026
5 checks passed
@MichalBryxi
MichalBryxi deleted the feat/date-time-granularity branch October 15, 2026 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DateInput/DatePicker: time segments (@granularity hour/minute)

2 participants