Skip to content

Conversation

@jeffhuys
Copy link

Exposing the internal date object
I've added support for exposing the internal date object of the calendar view. You can use this as follows:

<div pickadate ng-model="calendarDate" current-date="calendarCurrentDate"></div>

Now, calendarCurrentDate will be the Date object of the calendars' current view. For instance, when the user sees "December 2015", and calls calendarCurrentDate.getMonth() it will return the month number.

Showing events on the calendar
I've also added support for supplying an array with formatted dates to show in the calendar. Use it like this:

<div pickadate ng-model="calendarDate" dates-with-events="calendarPopulatedDates"></div>

In my case, I've added dates like this:

// Get all events from the API
Event.getAll(function(events) {
    console.log('Events retrieved', events);
    $scope.events = events;

    // Add every event to the calendar
    events.forEach(function(event) {
        var date = new Date(event.begin * 1000);
        var year = date.getFullYear().toString();
        var month = (date.getMonth()+1).toString();
        var day = date.getDate().toString();

        $scope.calendarPopulatedDates.push(year + '-' + (month[1]? month : '0'+month[0]) + '-' + (day[1]? day : '0' + day[0]));
    });
});

Note: this may not be the most efficient way to do this.

It looks like this:

screen shot 2015-12-15 at 14 21 58

To conclude

This is one of my first pull requests. I hope everything is right! If not, please let me know. I'll gladly update my code.

@restorandodeploy
Copy link

By analyzing the blame information on this pull request, we identified @gschammah, @ndrisso and @asharbitz to be potential reviewers

@jeffhuys
Copy link
Author

The build seems to have failed. I've updated the code.

EDIT: If someone could help me out with parsing the errors, I'd appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants