Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a text change event which triggers when the user writes something in text-input mode #906

Closed
RaulRohjans opened this issue Jun 12, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@RaulRohjans
Copy link

Is your feature request related to a problem? Please describe.
I'm trying to implement a system where the value of the datepicker is the current date/time on the blur event, if there is no modelValue. Something like the following:

			onUnfocus() {
				if(this.model) return

				const dateNow = new Date()
				if(this.format === 'time')
					return this.model = {
						hours: dateNow.getHours(),
						minutes: dateNow.getMinutes()
					}
					
				this.model = dateNow.toString()
			}

The issue is that the update:modelValue event is only triggered with the user releases the focus of the datetime picker, and the if model is null because the picker is initially empty and the user starts writing something and releases focus, their text gets replaced with the current date.

Describe the solution you'd like
An easy way to fix this is to have access to the value of the text-input and check if that's empty instead of the model. Could be done through a text-change event.

Describe alternatives you've considered
Currently I have no alternative to overcome this problem.

Additional context
None

@RaulRohjans RaulRohjans added awaiting triage The issue is not reviewed by the maintainers enhancement New feature or request labels Jun 12, 2024
@Jasenkoo Jasenkoo removed the awaiting triage The issue is not reviewed by the maintainers label Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants