1

I have this:

            <a href="#" data-bs-datepicker
               data-date-startDate="{{startDate(task)}}" data-ng-model="task.plannedEndDate"
               rel="tooltip" data-placement="left"
               title="${message(code: "dashboard.todosAndTasks.hint.editDueDate")}">
                {{task | dateIndication}}
            </a>

and the function:

    $scope.startDate = function(task) {
        var d = new Date(task.plannedStartDate);
        var curr_date = d.getDate();
        var curr_month = d.getMonth() + 1; //Months are zero based
        var curr_year = d.getFullYear();
        var m = curr_date + "/" + curr_month + "/" + curr_year;
        console.log(m);
        return m;
    };

The function gets called, I get a correct date-string logged in my console, but in the datepicker js, if I log the date received by this 'startDate' parameter, it's the actual string "{{startDate(task)}}" -> startDate automatically set to "today".

Why in the world does this happen?

++ only using data-date-startDate="startDate(task)", passess the string "startDate(task)" to the datepicker.js

Why!!?

4
  • please provide a fiddle on your problem Commented Jan 23, 2015 at 9:54
  • What is not clear? I'm relatively new to angular and don't really know how to transpose a 500 line js and 500 line html in just a simple example. Sorry about this -.- Commented Jan 23, 2015 at 10:10
  • you should build a simple example which represents your problem. this will help us help you ;) Commented Jan 23, 2015 at 10:36
  • maybe you can extend this one: jsfiddle.net/HB7LU/10320 Commented Jan 23, 2015 at 10:48

1 Answer 1

2

Try this:

<a href="#" data-bs-datepicker
           start-date="{{startDate(task)}}" data-ng-model="task.plannedEndDate"
           rel="tooltip" data-placement="left"
           title="${message(code: "dashboard.todosAndTasks.hint.editDueDate")}">
            {{task | dateIndication}}
 </a>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.