Skip to content

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

Closed
@RaulRohjans

Description

@RaulRohjans

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions