Eonasdan / tempus-dominus

A powerful Date/time picker widget.
https://getdatepicker.com
MIT License
7.16k stars 4.41k forks source link

Manual writing date inside input not recognized/parsed like old datetimepicker v3 #2921

Closed itajackass closed 2 weeks ago

itajackass commented 2 weeks ago

Prerequisites

Describe the issue

Hi, with old "datetimepicker", all my input was initialized for italian standard:

format: 'dd/MM/yyyy'

Some user using "calendar icon" to select a date from calendar picker, other users manual write inside input to speedup form compiling. For example, if a user need to select christmas day of year 2023, simply write:

251223

inside input field!

With old datetimepicker it was automatic recognized, on focus out, and became '25/12/2023'

Now with new tempus dominus (v6) it seems this very good function is missing and I get:

`TD: Custom Date Format: Unable to parse provided input: 251223, format: dd/MM/yyyy`

. Any change to restore this feature? Thanks

StackBlitz fork

https://stackblitz.com/edit/tempus-dominus-v6-simple-jquery-setup-n79xp8?file=index.js,index.html

What operating system(s) are you seeing the problem on?

Windows

What browser(s) are you seeing the problem on?

Firefox

What version of are you using? You can find this information from the sample StackBlitz.

v6

What your browser's locale? You can find this information from the sample StackBlitz.

it-IT

Eonasdan commented 2 weeks ago

I am no longer supporting this library for free.

The error is correct. The "date" that was entered is not in the correct format. Previous versions used momentjs to guess the input when the format was incorrect. v5+ doesn't use moment and therefore doesn't try to make guesses. I'd suggest some kind of input validator or mask