icehaunter / vue3-datepicker

Simple datepicker component for Vue 3
https://icehaunter.github.io/vue3-datepicker/
MIT License
150 stars 153 forks source link

typable: formating before I finish typing the date. #56

Closed TheNaschkatze closed 1 year ago

TheNaschkatze commented 3 years ago

When typing a date, for example 30.11.2023

the watch(input.value) triggers and formats my date. The problem is, as soon as I start writing the year (in this case number 2), I get the formatted date 30.11.0002. In other words, it formats my dates before I finish writing it.

eddit: If you need a quickfix, following will work as long as you have an inputFormat:

in the file datepicker.vue inside const keyUp you have to replace:

if (isValid(parsedDate))

with

if (isValid(parsedDate) && input.value.length === props.inputFormat.length)

Arthurin915 commented 3 years ago

This is also happening to me, do you have any workaround? I really need to use a datepicker in my company project

TheNaschkatze commented 3 years ago

This is also happening to me, do you have any workaround? I really need to use a datepicker in my company project

@Arthurin915 yep! Fork the repo and in the file datepicker.vue inside const keyUp you have to replace:

if (isValid(parsedDate))

with

if (isValid(parsedDate) && input.value.length === props.inputFormat.length)

this will make the trick as long as you give an inputFormat ;)

PurnimaCompro commented 2 years ago

I am also facing similar issue. Is there a ETA for a fix on this issue.

icehaunter commented 1 year ago

Fixed in https://github.com/icehaunter/vue3-datepicker/pull/61 (since v0.3.2)