jtsage / jtsage-datebox

A multi-mode date and time picker for Bootstrap (3&4), jQueryMobile, Foundation, Bulma, FomanticUI, and UIKit (or others)
http://datebox.jtsage.dev/
Other
474 stars 166 forks source link

Setting defaultValue with Arabic language results in exception #380

Closed dpolivy closed 9 years ago

dpolivy commented 9 years ago

Using jQM Datebox 1.4.5 with the "ar" i18n file.

defaultValue is set to an ISO formatted date (e.g. 2015-07-22).

When initializing the datebox on this HTML input, it throws an exception: Unable to get property 'length' of undefined or null reference source

It appears as though in this case, _makeDate is called without a parameter, which then calls the _dRep function with undefined. Should it be using the defVal instead?

The code path all starts in create.

jtsage commented 9 years ago

That bit of function is actually responsible for making sure we are not feeding unicode digits to the date function - I suspect there are not any browsers out there that will enjoy it. I've thrown a fix for this in (commit next), and I suspect all is well now - what I can't tell is if defaultValue is working while using ar, as reading arabic is not even almost in my skill set. My guess is that it is, as the display when I set a defaultValue differs from when I don't, but I'm just not sure.

dpolivy commented 9 years ago

This fix does appear to address the exception. I don't speak/read Arabic either, but doing some basic sanity testing with Google Translate, it does appear to be working properly.

jtsage commented 9 years ago

Brilliant, thanks for checking.