Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Johan 188 posts 380 karma points
    Nov 10, 2014 @ 16:33
    Johan
    0

    Can't get "populated" date

    Hi Dan! Awesome little package you've made. I just got a small problem. Using Umbraco 7.1.8 i tried "Initialise with Current Date?". It looks like it works, the field gets populated but when trying GetPropertyValue<Diplo.DateRangePicker.DateRange>("dateRange") it's just blank.

    If i press the datepicker and just hit "apply" it saves just fine.

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Nov 10, 2014 @ 21:35
    Dan Diplo
    101

    Hi Johan!

    Good spot, I think you've found a bug :) However, there should be a quick fix...

    Go to the /App_Plugins/DateRangePicker/ folder and open daterangepicker.controller.js in a text editor. Find line 49 which should be:

    $(dateBox).val(startDate.format(dateFormat) + " - " + endDate.format(dateFormat));

    Directly after this add the following line:

    $("#diplo-drp-json-" + $scope.model.alias).val(startDate.format(uFormat) + "," + endDate.format(uFormat)).trigger('input');

    So the entire block should look like:

    else if (initialiseCurrent) {
        var startDate = moment();
        var endDate = moment().add('days', 1);
        $(dateBox).val(startDate.format(dateFormat) + " - " + endDate.format(dateFormat));
        $("#diplo-drp-json-" + $scope.model.alias).val(startDate.format(uFormat) + "," + endDate.format(uFormat)).trigger('input');
    }
    

    You'll need to force-reload the page to ensure the JS changes get picked up. I normally use Chrome Dev tools (f12) and go to settings (gear icon) and tick the "disable cache when dev tools open" - then force reload. You can also try restarting app pool. This should fix it.

    Thanks for taking time to report this.


    Dan 

     

  • Johan 188 posts 380 karma points
    Nov 11, 2014 @ 11:59
    Johan
    0

    Thanks! Just a heads up. This sets the current time too. That may be something that you don't want. Easy to reset to 00:00:00 though :)

Please Sign in or register to post replies

Write your reply to:

Draft