feat(NcDateTimePicker): manual date input#8443
feat(NcDateTimePicker): manual date input#8443SebastianKrupinski wants to merge 1 commit intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8443 +/- ##
==========================================
+ Coverage 54.55% 54.58% +0.02%
==========================================
Files 104 104
Lines 3400 3400
Branches 993 993
==========================================
+ Hits 1855 1856 +1
+ Misses 1306 1305 -1
Partials 239 239 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
421b475 to
0f5e4fc
Compare
|
Changing to |
ShGKme
left a comment
There was a problem hiding this comment.
In general, I'm unsure if it makes sense to have manual input without masking the value or explicitly specifying the format to the user.
It is clear when editing the current value, but quite unclear for new values.
What about disabling manual input at all?
cc @nextcloud-libraries/designers
| /** | ||
| * Enable or disable manual text input for the date picker. | ||
| * | ||
| * @default true | ||
| */ | ||
| manualInput?: boolean |
There was a problem hiding this comment.
We follow no-boolean-default props as more natural for HTML-styled template, allowing using boolean shortcut like in HTML.
<!-- default: true -->
<NcDateTimePicker />
<NcDateTimePicker :manualInput="false" />
<!-- default: false -->
<NcDateTimePicker />
<NcDateTimePicker noInput />| /** | |
| * Enable or disable manual text input for the date picker. | |
| * | |
| * @default true | |
| */ | |
| manualInput?: boolean | |
| /** | |
| * Disable date text input | |
| */ | |
| noInput?: boolean |
or
| /** | |
| * Enable or disable manual text input for the date picker. | |
| * | |
| * @default true | |
| */ | |
| manualInput?: boolean | |
| /** | |
| * Disable date text input | |
| */ | |
| noTextInput?: boolean |
There was a problem hiding this comment.
I left this as manualInput with a boolean on purpose, the underlying component actually supports:
- False
- True
- Options {
enterSubmit = true,
tabSubmit = true,
}
This way the options can be implemented later without having multiple props and/or breaking functionality.
There was a problem hiding this comment.
I agree with Grigorii here, we should stick with no boolean default rather than some underlying library.
In general we should not care about the library we wrap as we should define an interface and translate this to the library and not the otherway around.
| @keydown.enter.capture="onManualInputKeySubmit" | ||
| @keydown.tab.capture="onManualInputKeySubmit" | ||
| @textInput="onTextInput" |
There was a problem hiding this comment.
This breaks accessibility by preventing using the data picker (the menu popup) via keyboard.
Previously, when the focus was in the input field, the menu could be open by typing or pressing Space, and then moving the focus to the menu by Tab
Now, Space acts as text input, and Tab goes to the next element, without opening the menu.
There was a problem hiding this comment.
If a user can type in a date, this is much easier then trying to navigate a popup menu with a keyboard, so I don't seem this as a problem.
Alternatively we could disable the tab capture and a user can tab in to the menu.
I was actually thinking of disabling the popup menu on manual input, but thought is was a good visual feed back that the correct date is selected.
There was a problem hiding this comment.
But not if the input value is changed significantly.
I enter 10/22/2026. Then I want to edit it changing the month, for example, 10 to 11. I go back and get Oct 22, 2026, where I actually need to change Oct to Nov.
| } | ||
|
|
||
| const input = event.target instanceof HTMLInputElement ? event.target.value : '' | ||
| const tempDate = new Date(input) |
There was a problem hiding this comment.
It works with the date input and date-time input, but it breaks on the week input, the month input, the year input and the range input.
There was a problem hiding this comment.
Oh, will look in to it.
This implementation supports multiple input formats, the one in the video above in not event a standard input format, You can input, YYYY-MM-DD MMM DD YYYY DD.MM.YYYY DD/MM/YYYY So forcing the user to use a specific format is not feasible, also since users are uses to using their localized format. |
The first problem is specifying. Without knowing the supported format, a user just doesn't know in what format they should enter the data.
Which makes it even harder if a user didn't learn the "JS Date parser" format.
I cannot, this is an
But it will be parsed as
|
|
From the design side, it is tricky. Being able to manually enter a date is really valuable, but indeed, https://jsdate.wtf. But I've also seen this done right. There are only so many possible date formats out there, and they are documented. People have wrote parsers before that cover 99.5% of what users will input, aside from typos. I'd like that. But it's also fine to just have a placeholder in ISO 8601 for new values, like just the string |


☑️ Resolves
🖼️ Screenshots
Recording.2026-04-18.210922.mp4
🏁 Checklist
stable8for maintained Vue 2 version or not applicable