Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style the selected date in the datepicker #58

Closed
chrillewoodz opened this issue Dec 29, 2015 · 10 comments
Closed

Style the selected date in the datepicker #58

chrillewoodz opened this issue Dec 29, 2015 · 10 comments

Comments

@chrillewoodz
Copy link
Contributor

I thought this was implemented but it doesn't look like it is, how can I alter this line:

ng-class="::day.class"

To also add a selected class to the date that is selected? Not sure what the ::day.class does exactly or what condition to apply for the selectedclass.

I'd appreciate some help :)

@mobinni
Copy link
Owner

mobinni commented Dec 29, 2015

Override the css class, css is a waterfall structure so if you redeclare new css for the day class it will be applied.

@chrillewoodz
Copy link
Contributor Author

Well ye I know but the day that is currently selected looks no different from the other days that aren't. So how am I supposed to apply the necessary CSS to just the selected day?

@mobinni
Copy link
Owner

mobinni commented Dec 29, 2015

there must be something wrong with your setup, because here: http://mobinni.github.io/material-date-picker/example/ you can clearly see a difference.

@chrillewoodz
Copy link
Contributor Author

A selected day:

<td ng-click="selectDate(day)" class="noselect ng-binding ng-scope day-item day" ng-class="day.class" ng-repeat="day in week">10</td>

A non-selected day:

<td ng-click="selectDate(day)" class="noselect ng-binding ng-scope day-item day" ng-class="day.class" ng-repeat="day in week">11</td>

How is this clearly a difference? I think you're misunderstanding the issue :)

@mobinni
Copy link
Owner

mobinni commented Dec 29, 2015

    else if newDate.format(scope.dateFormat) == moment().format(scope.dateFormat)
      day.isToday = true;
      day.isEnabled = true;
      day.class = 'day-item today';

when a day is today, it will get the today class, from the website

noselect ng-binding ng-scope day-item today

@chrillewoodz
Copy link
Contributor Author

But I don't want the today class, because today might not be the date that the user has selected. I want the selected date, i.e. the date that the user clicked.

@mobinni
Copy link
Owner

mobinni commented Dec 29, 2015

Ohh now I understand what you mean, yes that was not implemented. After a date is selected, the date picker closes. I did not see the need to implement a current_date class. Best would be to fork and implement it. A pull request would be appreciated.

@chrillewoodz
Copy link
Contributor Author

Ye but if you open it again you basically have no idea what date you've previously selected, so it really is a necessity for a datepicker plugin. I tried to implement it but got some readonly assignment error, I'll try to make some viable solution but would be great if you could create a fix since you know more how it works than me and I'm on a limited development time.

@mobinni
Copy link
Owner

mobinni commented Dec 29, 2015

Or you could just read the date in the input field? I would love to implement it, but as I said I'm too short on time :/ many projects

@chrillewoodz
Copy link
Contributor Author

Found a really good solution actually, very performance effective. Will fork when I have some time left over :)

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

No branches or pull requests

2 participants