Repository navigation
Datetime picker as a form component - #123
Merged
joshunrau merged 9 commits intoOct 5, 2026
Merged
Conversation
joshunrau
requested changes
Oct 5, 2026
joshunrau
left a comment
Collaborator
There was a problem hiding this comment.
So, two comments on this:
- should we support a 24 hour time (i.e., 13:00) for French?
- can we add some way to indicate am vs pm?
Otherwise, looks terrific!
joshunrau
approved these changes
Oct 5, 2026
|
🎉 This PR is included in version 6.17.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
feat: add DateTimeField form component
Adds a
DateTimeFieldcomponent tosrc/components/Form. It lets the user pick a calendar date and a time of day, and produces a singleDatevalue. The layout follows the shadcn/ui date picker with time.Changes
DateTimeField.tsx: new component insrc/components/Form/DateTimeField/YYYY-MM-DD. Clicking it opens the existingDatePickerin aPopover.<input type="time" step="1">that shows seconds and hides the browser's picker icon. It starts at00:00:00.DateField(BaseFieldComponentProps<Date>pluslabel,descriptionanddisabled).disabledandreadOnlyturn off both controls.DateTimeField.stories.tsx: four stories:Default,WithInitialValue,DisabledandWithError.DateTimeField.spec.tsx: 10 tests covering the default render, opening the popover, picking a date, setting the time before or after the date, clearing the time, rendering a value passed in, resetting and disabling.libui.json: new translation keysform.date,form.selectDateandform.time(en / es / fr).Not included
DateTimeFieldis not yet connected toForm/ScalarField.@douglasneuroinformatics/libui-form-typeshas no datetime field type yet, so for now the component can only be used on its own. See "Next steps".Next steps:
libui-form-typesFor
Formto render aDateTimeFieldfrom a field config, the form-types package has to describe a datetime field first:libui-form-types. Recommended: add an optionalvariantto the existing date field:Date, soScalarFieldValueand zod schemas don't change. Existingkind: 'date'configs keep working, and anyswitch (field.kind)in a dependent package stays exhaustive.Alternative: a separate
kind: 'datetime'(DateTimeFormField) added toScalarField/AnyScalarFormField. This makes the two fields more clearly distinct, but it is a breaking change for any package that switches over everykind, includingScalarFieldin this repo.libui-form-types: a minor bump for thevariantoption, or a major bump if we add a newkind.DateTimeFieldPropsto come from the updated form type.DateTimeFieldinScalarField.tsx: checkfield.variant === 'datetime'inside the'date'case, or add a'datetime'case.Form.stories.tsxand a test inForm.test.tsxthat submits through the reset/submit flow.Testing
pnpm exec vitest run src/components/Form: all tests passtscandeslint: cleanDateTimeFieldstories render.🤖 Generated with Claude Code
Closes issue #122