Gillardo / bootstrap-ui-datetime-picker

AngularJs directive to allow use of the bootstrap UI date/time pickers in a single dropdown
MIT License
306 stars 168 forks source link

masking a datetime seems to go wrong #223

Closed Maw-Jung closed 6 years ago

Maw-Jung commented 6 years ago

In version 2.6.2 the commit 71fb27f190c49b17d325a4ffc2ad18ea8c4a4c79 introduced a new function called 'applyMask'. The 'maskedValue' is checked against allowed characters and uses the mask character whenever one is found in the allowed characters and the actual value otherwise. In the latter case the counter isn't increased.

Gillardo commented 6 years ago

Not sure I understand? Can u add plunkr to show?

Maw-Jung commented 6 years ago

"18.04.2018 11:57 PM" with a format of "dd.MM.yyyy hh:mm a" will become "18..0.4.20 18: 1 a" because the variable 'valueArrayIndex' will only be increased for characters found in the allowed characters. Just take any plnkr and slap the current datetimepicker library (2.6.2) on it: http://plnkr.co/edit/qTXYhDMtTzvK7UWlr3Fy?p=preview By debugging into the function when selecting any date you can see the described result

Gillardo commented 6 years ago

I would need to look at the code. Someone else created the pulse request for it

Gillardo commented 6 years ago

@afro1114 ???

Blackbaud-ChristopherHlusak commented 6 years ago

I believe we experienced a problem with the adjustment of this area of the code as well. A date format of M/d/yyyy will let dates with two digit months to pass the regex (since if you drop the first character from 12/3/2017 it will be 2/3/2017) but a date with two digit days fails this, since 4/17/2018 won't match d/d/dddd pattern - which arguably it should. (worked with 2.6.1).

Perhaps I am misunderstanding the expectation of how the date format should work, but wanted to raise this case here in the event it's helpful.

Gillardo commented 6 years ago

I have disabled masking as this seems to be causing issues for people. I have uploaded 2.6.3, hopefully this helps