Date picker hide future dates

Hi,

  1. I have custom module
  2. I have created date of birth custom field using tpl
  3. not i want to hide future dates while clicking on the calendar image.
    How do i achieve this can anyone guide on this.

Suite crm version : 7.9.11

Thanks in Advance

I don’t know, but you can try to find the relevant code if you look at the rendered HTML and the Javascript that your browser gets for that date/time picker control.

Then you can look for the SuiteCRM files that produce it.

The file include/javascript/calendar.js is used to setup the Date Picker for Date/Datetime fields. yet for disabling the Past Dates, i have not found any workaround for the moment. I have seen the use of custom params like the following suggestion but it does not work.

> Search for line calendar.cfg.setProperty("selected" just after that line add following code
if(typeof(params.customMinDate) != 'undefined')
    calendar.cfg.setProperty("minDate", params.customMinDate);

And then in your calendar setup array, you should add following param,

customMinDate : new Date(),

Another code suggestion was to use disableFunc param which also does NOT limit date selection.

 <script type="text/javascript">
                              var now = new Date();
                              Calendar.setup ({
                                  inputField : "meeting_date_2",
                                  ifFormat : cal_date_format,
                                  daFormat : "%d/%m/%Y %I:%M%P",
                                  button : "meeting_date_2",
                                  disableFunc: function(date)  {
                                      var now = new Date();

                                      if(date.getFullYear() < now.getFullYear()) { return true; }
                                      if(date.getFullYear() == now.getFullYear() && date.getMonth() < now.getMonth()) { return true; }
                                      if(date.getMonth() == now.getMonth() && date.getDate() < now.getDate()) { return true; }
                                  },
                                singleClick : true,
                                step : 1,
                                weekNumbers: false,
                                startWeekday: 0
                            });
                        </script>

The Calendar.js function is not able to support Disable Previous Days option. I can use jQuery Datepicker but as a suggestion the core crm should update files/functions to enable more control over fields.