Equip date/time input fields with a "now" option#141
Open
Oleg-Melnik wants to merge 3 commits into
Open
Conversation
…ing. Introduce a reusable base for setting an `InputField` value in code: - `InputField.applyValue` sets the field's value programmatically, reusing the same parsing, validation, and dirty-state bookkeeping as a user's edit (via the extracted `commitRawText`), so the displayed text stays consistent with the value and any prior validation error is cleared. - `InputField.handleKeyEvent` is an overridable hook, consulted before the input reviser, that lets subclasses implement field-specific keyboard shortcuts. - `WallClock.now` exposes the current moment as an `Instant`, the single point through which time-dependent behavior should obtain the current time. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add an opt-in affordance that fills the field with the current date and time, so the user doesn't have to type it by hand when recording something at the moment it happens. - `nowOptionEnabled` turns on a button, shown within the field, and the Ctrl+N keyboard shortcut; `nowOptionAffordance` allows customizing the button. - The current moment comes from `WallClock`, and the stored value is truncated to the resolution of `dateTimePattern`, so it stays consistent with the text shown in the field (`formatDateTime` preserves sub-second precision when the pattern includes it). - The default button is a compact icon that keeps the field's height, gives hover/press/focus feedback, shows a tooltip, and exposes full button semantics (role, accessible click action, disabled state, focusability, and Enter/Space activation). Mouse activation uses low-level pointer events, since a `clickable`/`IconButton` gesture is intermittently cancelled inside the text field's decoration. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Regenerate the `pom.xml` and `dependencies.md` reports accordingly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Oleg-Melnik
marked this pull request as draft
July 24, 2026 20:48
Oleg-Melnik
marked this pull request as ready for review
July 24, 2026 20:56
dpikhulya
approved these changes
Jul 24, 2026
armiol
approved these changes
Jul 25, 2026
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.
Closes #140.
Summary
Adds an opt-in "now" affordance to
DateTimeFieldthat fills the field with thecurrent date and time, so the user doesn't have to type it by hand when
recording something at the moment it happens. The current moment is sourced
through
WallClock, and the filled value is truncated to the resolution ofdateTimePattern, keeping the stored value consistent with the displayed text.Changes
DateTimeField.nowOptionEnabled— opt-in property (off by default) thatshows a button within the field and enables the
Ctrl+Nshortcut.DateTimeField.nowOptionAffordance— optional custom renderer, receiving afillNowcallback, used instead of the default button.formatDateTimepreserves sub-second precision when the pattern includesit; otherwise the value is truncated to the pattern's resolution.
WallClock.now— exposes the current moment as anInstant, the singlepoint through which time-dependent behavior obtains the current time.
InputField—applyValuesets a value programmatically (reusing thenormal parse/validate/dirty bookkeeping), and a
handleKeyEventhook letssubclasses implement field-specific keyboard shortcuts.
and a tooltip, and exposes full button semantics (role, accessible click
action, disabled state, focusability, and Enter/Space activation).
compose.materialIconsExtendedto theprotomodule for the buttonicon.
WallClockSpec, andDateTimeFieldSpeccases for pattern truncationand sub-second round trips.
Reviewer notes
Mouse activation of the default button uses low-level pointer events rather than
clickable/IconButton, because that gesture is intermittently cancelled whenplaced inside the text field's decoration slot.