NOD507 / SenseDateRangePicker

A date range picker extension for qliksense
36 stars 39 forks source link

Does not work in Qlik Sense 3.1 Desktop or Server #9

Closed ghost closed 7 years ago

ghost commented 7 years ago

When you try to select a date range in Qlik Sense 3.1, the following error is thrown in the console and the date criteria are not selected, but otherwise no error message is displayed:

Error: x.qLocaleInfo is undefined SelectRange/<@http://localhost:4848/extensions/DateRangePicker/DateRangePicker.js??1474643886398:184:29 h@http://localhost:4848/resources/assets/external/requirejs/require.js?1474643886398:45:1990 i/<@http://localhost:4848/resources/assets/external/requirejs/require.js?1474643886398:45:2162 vc/this.$get</n.prototype.$eval@http://localhost:4848/resources/assets/external/requirejs/require.js?1474643886398:45:9671 vc/this.$get</n.prototype.$digest@http://localhost:4848/resources/assets/external/requirejs/require.js?1474643886398:45:8175 vc/this.$get</n.prototype.$evalAsync/<@http://localhost:4848/resources/assets/external/requirejs/require.js?1474643886398:45:9760 e@http://localhost:4848/resources/assets/external/requirejs/require.js?1474643886398:43:22487 kb/l.defer/c<@http://localhost:4848/resources/assets/external/requirejs/require.js?1474643886398:43:23940

It looks like there's an easy fix here to just set the DateFormat in Sense DateRangePicker:SelectRange:184 so a reasonable format like "YYYY-MM-DD". Since this function is just submitted the date to the engine api, the specific format doesn't matter much (as far as I can tell).

I did take a look at the new layout data and couldn't find where the locale information was moved to, and unfortunately it doesn't look like the qlik developer api docs list this field.

I'll submit a pull-request to make this small fix.

NOD507 commented 7 years ago

Hi 16bytes, thank you for submiting an issue and a pull request!

Im looking at this but the weird thing is that the extension is working on my desktop and server without any changes.

The format is actually important because we are making a range search in the listobject sending a string, if the date is not in the same format declared in the load script it wont work (i tested it).

Could you send me a qvf just with the date loaded? maybe is something with the regional defaults in the load script declarations.

I tested with qliksense desktop 3.1 and 3.1.1 desktop and server

ghost commented 7 years ago

You're right.

It looks like when you don't specifically set the TimestampFormat and DateFormat, layout.qListObject.qDimensionInfo.qNumFormat doesn't have a qFmt property, and x.qLocaleInfo is undefined as well.

SenseDateRangePicker-Issue9.zip

What would be a better way to handle this case?

NOD507 commented 7 years ago

Hi, i pushed a new version. The qLocaleInfo object was a level inside the app object returned in the promise i was using. should work fine know. please try with a field with date() applied in the load script. this was not a problem of sense 3 just an oversight when i wrote that

ghost commented 7 years ago

Ah yes, this is a much better fix. When I was investigating the issue, I thought that I had inspected the app object looking for the qLocaleInfo field and didn't see it. Apparently, I didn't look hard enough.

I tested this both ways (with and without setting the date format in the load script), and this seems to have fixed this issue.

Thanks, at this point I think you can close this ticket.

NOD507 commented 7 years ago

Great, thanks for your help.