Home Analyst Portal

Hide Dates

Alex_MarshAlex_Marsh Premier Partner Advanced IT Monkey ✭✭✭
When using any datepicker I notice that all dates are shown when request offering configuration is set to only show todays date onwards or a specific range of dates. Is it possible to exclude these from the selectable dates, rather than showing the "The date entered is not within the specified range." message?

Best Answer

  • Alex_MarshAlex_Marsh Premier Partner Advanced IT Monkey ✭✭✭
    Answer ✓
    I've cracked it, the script needs to be set to this in order to work correctly:
    $(window).load(function() {
    	if(document.URL.indexOf("ServiceCatalog/RequestOffering") > -1){
        $('input[data-control="dateTimePicker"]').data('kendoDateTimePicker').timeView.options.interval = 15;
    }});

    Modifying these kendo controls is a bit of a faff!

Answers

  • Tony_CollettTony_Collett Cireson Support Super IT Monkey ✭✭✭✭✭
    Hi Alex, 
    I'm currently using a stock standard version of 8.1.1 and I have constraints the same as you do. It looks like this: 

    I have it constrained on the other side as well (after 90 days) and it only shows between today's date and January

    Is this not what you are seeing?
  • Alex_MarshAlex_Marsh Premier Partner Advanced IT Monkey ✭✭✭
    Hi Alex, 
    I'm currently using a stock standard version of 8.1.1 and I have constraints the same as you do. It looks like this: 

    I have it constrained on the other side as well (after 90 days) and it only shows between today's date and January

    Is this not what you are seeing?

    Nope, it's presenting all days


    Then showing this message, despite the dates being constrained

    I think it's to do with this bit of code which sets the interval for the time to 15 minutes as when I disable this it functions correctly.

    $(window).load(function() {
     if(document.URL.indexOf("ServiceCatalog/RequestOffering") > -1){
        $('input[data-control="dateTimePicker"]').kendoDateTimePicker({ interval: 15 });
    }});

    Though I'm confused why setting an option on the interval would do this

  • Alex_MarshAlex_Marsh Premier Partner Advanced IT Monkey ✭✭✭
    Answer ✓
    I've cracked it, the script needs to be set to this in order to work correctly:
    $(window).load(function() {
    	if(document.URL.indexOf("ServiceCatalog/RequestOffering") > -1){
        $('input[data-control="dateTimePicker"]').data('kendoDateTimePicker').timeView.options.interval = 15;
    }});

    Modifying these kendo controls is a bit of a faff!

  • Alex_MarshAlex_Marsh Premier Partner Advanced IT Monkey ✭✭✭
    edited October 2017
    Hmmm doesn't seem to work when the date field appears as part of an advanced request offering (the option doesn't get set when the date field appears. Seem to be going 1 step forward and 2 back all the time with this!
  • Alex_MarshAlex_Marsh Premier Partner Advanced IT Monkey ✭✭✭
    It would appear I forgot that you needed to find all of the objects and apply the setting. The code below solves this!
    $(window).load(function() {<br>&nbsp;if(document.URL.indexOf("ServiceCatalog/RequestOffering") > -1){<br>&nbsp;&nbsp;var dt = $('input[data-control="dateTimePicker"]');<br>&nbsp;&nbsp;$(dt).each(function () {<br>&nbsp;&nbsp;if($(this).length > 0){<br>&nbsp;&nbsp;&nbsp;$(this).data('kendoDateTimePicker').setOptions({interval : 15})<br>&nbsp;&nbsp;};<br>&nbsp;});<br>}<br>});
Sign In or Register to comment.