twinssbc / AngularJS-ResponsiveCalendar

A pure AngularJS responsive calendar directive
http://twinssbc.github.io/AngularJS-ResponsiveCalendar/demo/
MIT License
112 stars 77 forks source link

How to highlight current date in week view. #10

Closed arepalli-praveenkumar closed 9 years ago

arepalli-praveenkumar commented 9 years ago

Hi @twinssbc , When i was in week view i am little confused what is the current date(user perspective) . How to do it.I Do see in month view as we highlighted current date.

twinssbc commented 9 years ago

@praveenkumararepalliGit in the getDates function in weekview directive, it generates the date objects in current week and these date objects are used in the weekview header. You can add another today property,

dates[i++] = {
    date: new Date(current),
    today: ctrl.compare(current, new Date()) === 0
};

Then in the week view template, when enumerating the date objects in the header, you can check if the today property is true and assign some css class to highlight this header.

<th ng-repeat="dt in dates" ng-class="{'weekview-current': dt.today}" class="text-center">{{dt.date| date: 'EEE M/d'}}</th>
arepalli-praveenkumar commented 9 years ago

@twinssbc thanks . Its working fine.