Hi Atlassians,

      Before 5.10 the following was working: https://docs.atlassian.com/aui/latest/docs/date-picker.html

      Now it just says: Undefined function when one tries to use it.

            [CONFSERVER-42831] AUI datepicker is not working on Confluence 5.10

            Perfect Alex! Well done!

            Thanks for your support

            Rafael Franco added a comment - Perfect Alex! Well done! Thanks for your support

            Thank you, Rafael. I have updated https://developer.atlassian.com/confdev/development-resources/preparing-for-confluence-5-10 with what we talked about.

            Alex Yakovlev (Inactive) added a comment - Thank you, Rafael. I have updated https://developer.atlassian.com/confdev/development-resources/preparing-for-confluence-5-10 with what we talked about.

            Hi Alex,

            Yesterday I reached the same conclusion. Before 5.10 I didn't specified the dependency directly in my webresource but for some reason it worked, with 5.10 one needs to be explicit about it so now it's working fine. I also reached the same conclusion because it would work when I had the web resources batching enabled, but not when it was disabled.

            Thanks for your time. We ended up reaching exactly the same conclusion. Maybe it would be good for other people to mention this in the "what's changed in 5.10"

            You can close the issue.

            Thanks again,
            Rafael

            Rafael Franco added a comment - Hi Alex, Yesterday I reached the same conclusion. Before 5.10 I didn't specified the dependency directly in my webresource but for some reason it worked, with 5.10 one needs to be explicit about it so now it's working fine. I also reached the same conclusion because it would work when I had the web resources batching enabled, but not when it was disabled. Thanks for your time. We ended up reaching exactly the same conclusion. Maybe it would be good for other people to mention this in the "what's changed in 5.10" You can close the issue. Thanks again, Rafael

            I have also raised an internal ticket to clarify the difference between $.datePicker and $.datepicker in our AUI docs.

            Alex Yakovlev (Inactive) added a comment - I have also raised an internal ticket to clarify the difference between $.datePicker and $.datepicker in our AUI docs.

            rfranco1 Can you confirm if you have the following dependency in your plugin xml file? It should be included within the web-resource element that houses the js files that require the date picker.

            <web-resource ...>
            ...
            <dependency>com.atlassian.auiplugin:aui-date-picker</dependency>
            </web-resource>

            Additionally, can you also double check that the date picker function you are using in your latest code is $.datePicker with a capital 'P'. It seems to be so in your latest screenshots, but I am seeing the lower case implementation in the Jar for the plugin. The lower case version refers to the standard jQuery UI implementation.

            It might just be that you are missing the dependency to the date-picker resources. Some other aspects of Confluence also require the datepicker, but where before it might have been included on the page by chance, we now aim to define all of our dependencies explicitly. Some of the code that may have been present on the page in earlier versions of Confluence may now be loaded asynchronously, so it's possible that the Date Picker js is loaded onto the page at some point but not as early as it may have been in previous versions. This may be why you are seeing it transparent at first but displaying properly if you add a delay.

            In the AUI documentation, you'll notice that not all the components are included in core, and an explicit dependency should be defined to ensure that the components will continue to work. For instance, the Date Picker is one of those components.

            https://docs.atlassian.com/aui/latest/docs/date-picker.html

            It may also be worth your time to double-check the AUI components that you are using in the plugin, and to make sure that explicit dependencies are provided for those components that require them.

            Please let me know if adding the dependency and double-checking the 'datePicker' text case solves this issue.

            Alex Yakovlev (Inactive) added a comment - rfranco1 Can you confirm if you have the following dependency in your plugin xml file? It should be included within the web-resource element that houses the js files that require the date picker. <web-resource ...> ... <dependency>com.atlassian.auiplugin:aui-date-picker</dependency> </web-resource> Additionally, can you also double check that the date picker function you are using in your latest code is $.datePicker with a capital 'P'. It seems to be so in your latest screenshots, but I am seeing the lower case implementation in the Jar for the plugin. The lower case version refers to the standard jQuery UI implementation. It might just be that you are missing the dependency to the date-picker resources. Some other aspects of Confluence also require the datepicker, but where before it might have been included on the page by chance, we now aim to define all of our dependencies explicitly. Some of the code that may have been present on the page in earlier versions of Confluence may now be loaded asynchronously, so it's possible that the Date Picker js is loaded onto the page at some point but not as early as it may have been in previous versions. This may be why you are seeing it transparent at first but displaying properly if you add a delay. In the AUI documentation, you'll notice that not all the components are included in core, and an explicit dependency should be defined to ensure that the components will continue to work. For instance, the Date Picker is one of those components. https://docs.atlassian.com/aui/latest/docs/date-picker.html It may also be worth your time to double-check the AUI components that you are using in the plugin, and to make sure that explicit dependencies are provided for those components that require them. Please let me know if adding the dependency and double-checking the 'datePicker' text case solves this issue.

            Thanks rfranco1, I am looking at this today.

            Alex Yakovlev (Inactive) added a comment - Thanks rfranco1 , I am looking at this today.

            I moved everything into AJS.toInit and still I have the same problem. The only way to make it work is giving it a 3/4 second delay before initialising the datePicker. I've attached 2 screenshots

            Rafael Franco added a comment - I moved everything into AJS.toInit and still I have the same problem. The only way to make it work is giving it a 3/4 second delay before initialising the datePicker. I've attached 2 screenshots

            Hi Alex,

            Thanks for your reply.

            Before we were using this functionality in Community Forums and was working fine. Granted we didn't called it inside of a ready function which was giving the function not found in javascript, which I just now changed and the error is gone. Still the datepicker looks transparent and different from what it was before. I've attached a screenshot so you can see. You can test it out using Community Forums: https://marketplace.atlassian.com/download/plugins/com.adaptavist.confluence.forums/version/1001090

            Regards,
            Rafael

            Rafael Franco added a comment - Hi Alex, Thanks for your reply. Before we were using this functionality in Community Forums and was working fine. Granted we didn't called it inside of a ready function which was giving the function not found in javascript, which I just now changed and the error is gone. Still the datepicker looks transparent and different from what it was before. I've attached a screenshot so you can see. You can test it out using Community Forums: https://marketplace.atlassian.com/download/plugins/com.adaptavist.confluence.forums/version/1001090 Regards, Rafael

            Hi Rafael,

            Can you please provide some additional information? And/or a code example you're using? Are you running into this issue in a plugin?

            I'm currently unable to reproduce the issue. When I add the following code, I get the expected result in both 5.9 and 5.10:

            <input class="aui-date-picker" id="demo-range-always" type="date" max="2012-01-25" min="2011-12-25" />

            AJS.$(document).ready(function() {
            AJS.$('#demo-range-always').datePicker(

            {'overrideBrowserDefault': true}

            );
            });

            Can you also provide some more context into the error? Is this a JavaScript error? When does the error occur? Can you also post a copy of the stack trace, or a link to somewhere I could view the error? Is this in a specific plugin I can download and test with?

            Alex

            Alex Yakovlev (Inactive) added a comment - Hi Rafael, Can you please provide some additional information? And/or a code example you're using? Are you running into this issue in a plugin? I'm currently unable to reproduce the issue. When I add the following code, I get the expected result in both 5.9 and 5.10: <input class="aui-date-picker" id="demo-range-always" type="date" max="2012-01-25" min="2011-12-25" /> AJS.$(document).ready(function() { AJS.$('#demo-range-always').datePicker( {'overrideBrowserDefault': true} ); }); Can you also provide some more context into the error? Is this a JavaScript error? When does the error occur? Can you also post a copy of the stack trace, or a link to somewhere I could view the error? Is this in a specific plugin I can download and test with? Alex

              alyakovlev Alex Yakovlev (Inactive)
              3c7c04d87d93 Rafael Franco
              Affected customers:
              0 This affects my team
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: