Forums

Forums / Developing Portals / Bug when set format for CRM Date Time Form Widget

Bug when set format for CRM Date Time Form Widget

Thread is closed for posting
3 posts, 2 answered
  1. phamtrungson
    phamtrungson avatar
    12 posts
    Registered:
    07 Oct 2016
    07 Oct 2016
    Link to this post
    Hi everyone,

    How can I set date format "dd.MM.yyyy" ? I get a js error when setting it in advance widget designer, I also try using Custom date but it still don't work. I set "dd.MM.yyyy" in Custom Date but It gives 01.01.2001 00:00 result : (

    Thank you
  2. Missing user
    Missing user avatar
    Answered
    11 Oct 2016 in reply to phamtrungson
    Link to this post
    Hello Pham,

    I have tried the exact same format above to DateTime  Widget, and it is working fine. Please follow the instruction below;

    1) Use CRM Date/Time Widget on your form
    2) Go to Widget Edit-->Appearnace
    3) From the format dropdown select "Custom"
    4) Inside Custom Date text box put your required date format i.e. dd.MM.yyyy
    5) publish your form & test it on the respective page

    Kindly let me know if you still having an issue, I will then open a support case for this problem to further troubleshoot it in your portal site.

    Thanks
    Syed
  3. phamtrungson
    phamtrungson avatar
    12 posts
    Registered:
    07 Oct 2016
    Answered
    13 Oct 2016
    Link to this post
    I tried. But it gives me 'dd.MM,yyyy  HH:mm' maybe because my data type is "Date and Time". I cant set date format by modifying widget template too: 
     <telerik:RadDateTimePicker
    ...>
    ....
     <DateInput
            DateFormat="dd.MM.yyyy"
            DisplayDateFormat="dd.MM.yyyy">
            <ClientEvents OnLoad="onLoadRadDateTimePickerDateInput"/>
     </DateInput>
     </telerik:RadDateTimePicker>

    Finally, I do it by a "trick" with JS:

    <script type="text/javascript">
    function onLoadRadDateTimePickerDateInput(sender, agrs) {
        sender.set_dateFormat("dd.MM.yyyy");
        sender.set_displayDateFormat("dd.MM.yyyy");
    }
    </script>

    Hope it helps. Thank you in advance.
    Last modified on 13 Oct 2016 09:10 by phamtrungson
3 posts, 2 answered