Content Management and Capture

Content Management and Capture

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
Expand all | Collapse all

ICN Search Template Date Format

  • 1.  ICN Search Template Date Format

    Posted 01/22/21 11:35 AM

    Hi All,

    I have a search template. Some of the search criteria fields are date. The date format for these date fields is based on the locale of the browser.

    My requirement is to show only one date format dd/MM/yyyy irrespective of the locale. Please let me know whether this is possible through customisation.



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 2.  RE: ICN Search Template Date Format

    Posted 01/24/21 12:15 PM

    Hi,

    I am afraid this can't be implemented by plugin. This is controlled by UI js code and in a private method. You can only raise a FER(feature enhancement request) for it.

    Thanks,

    Jason



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 3.  RE: ICN Search Template Date Format

    Posted 01/25/21 03:17 AM

    Hi,

    You may edit the layout of the search template and set dd/MM/yyyy for the date pattern of the property.

    Regards,

    Angie



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 4.  RE: ICN Search Template Date Format

    Posted 01/25/21 03:21 PM

    Thanks Angie for the reply. Can you specify the exact method name?



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 5.  RE: ICN Search Template Date Format

    Posted 01/26/21 01:25 AM

    You may do that on ICN web client. Edit the search template, then click "Edit Layout". Select the date property, and input the "Date pattern" with dd/MM/yyyy in Settings on the right.

    Regards,

    Angie



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 6.  RE: ICN Search Template Date Format

    Posted 01/26/21 10:14 AM

    Hi Angie,

    I'm using ICN 3.0.3.

    I do not see "Edit Layout". I could see advanced settings where I can define whether field is read only/required/editable/hidden. Also I can select what are the operators I need.



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 7.  RE: ICN Search Template Date Format

    Posted 01/26/21 12:36 PM

    Sorry, I misunderstood the question. Please ignore my previous comments. You may set a default date format in JS of your plugin. Here is an example,

    ecm.model.ValueFormatter.prototype.getDefaultFormat = function(type) { ... } else if (type == "xs:date") { format = gregorian["dateFormat-short"]; if (this.locale == "ar" && document.dir == "ltr") { format = "d/M/yyyy"; } format="dd/MM/yyyy";// <<<< set your date pattern } else if (type == "xs:time") { ... };

    Note this overwrites the function of ICN and sets the specific format for all date type properties. Date pickers on other widget like Properties are affected too. Custom code is not officially supported. So please be careful when customizing the function.

    Regards,

    Angie



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 8.  RE: ICN Search Template Date Format

    Posted 01/26/21 02:18 PM

    Hi Jason,

    If I understood correctly you are from IBM right.

    How to differentiate the public and private methods in ICN js files. If a method starts with underscore(_), it is private method. Otherwise, it is public method?.

    Hope we can we overwrite/customise public methods right. Please confirm.




    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 9.  RE: ICN Search Template Date Format

    Posted 01/27/21 03:20 AM

    Hi,

    Yes, ​if a method starts with underscore(_), it is private method. Otherwise, it is public method.

    Actually, we are not allowed to provide private methods in our answers and we can only provide public methods in our sample code.

    It is more safe to overwrite/customize public methods, but you should also be careful to do that. As I said, the best way is to raise a FER and get official support from IBM. When we get a support case, we will first to ask customer to disable all the plugins and then debug the issue.

    Thanks,

    Jason



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 10.  RE: ICN Search Template Date Format

    Posted 01/27/21 07:44 AM


  • 11.  RE: ICN Search Template Date Format

    Posted 01/27/21 03:07 PM

    Thanks Angie. This method is public method. Hope no issues if we do the customisation. I have tried below code. I would expect the data type for the parameter type. But always getting the value "M/d/yyyy."


    aspect.after(ecm.model.ValueFormatter.prototype, "getDefaultFormat", function(type) {

    alert('inside getDefaultFormat');

    alert('type ::'+type);

    })



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 12.  RE: ICN Search Template Date Format

    Posted 01/28/21 02:02 AM

    aspect.after does not overwrite the function. You may try the sample code to see if it helps.



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 13.  RE: ICN Search Template Date Format

    Posted 01/28/21 02:24 PM

    Thanks Angie. It works perfect!



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 14.  RE: ICN Search Template Date Format

    Posted 01/28/21 03:00 PM

    Hi Jason,


    The method ecm.model.ValueFormatter.prototype.getDefaultFormat is public. Hope I can customize this method as suggested by Angie above.



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration