-
Notifications
You must be signed in to change notification settings - Fork 13
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
Allow multiple styles for Marked Dates #40
Comments
Hi @Sertage Can you post an example of possible options which use this new feature and image on how it is shown in calendar. Why not PR? You have a github account then it should be possible. |
Hi, Kekeh!
As you can see day 3 is used in both arrays (yoga and karate). I put color as empty string to not apply the deafult marker.
In my case I applied kind a background style color for each marked day. But I could play with borders instead as you do, or an image with relative position. Once I can use css class, more options are possible. |
You can do this with current functionality but you have to do some checks in your code. You have to remove date 3 from yoga and karate dates and put it to own array with own color. markDates: [
{
// yoga dates
color: 'yellow',
dates: [{day: 1, month: 1, year: 2020}, {day: 5, month: 1, year: 2020}]
},
{
// karate dates
color: 'blue',
dates: [{day: 2, month: 1, year: 2020}, {day: 4, month: 1, year: 2020}]
},
{
// yoga and karate dates
color: 'green',
dates: [{day: 3, month: 1, year: 2020}]
}
] |
I added this kind of functionality to the 0.6.1 version. Try to install it from npm. Check markDates option from README. Here is an example: https://github.com/kekeh/angular-mydatepicker/wiki/usage-of-markDates-option You have to check each array if there is conflict dates and put them to own array like I supposed in my previous message. You need to set only background attribute to CSS class because style goes to td element. Like an example. |
That is really cool, thank you very much for the support 😄 |
Hi, I am using your component that is fantastic for our purpose, though there is a small limitation that I think it can be improved.
Current behaviour allows to have different arrays of data in the MarkedDates option. You can define a color attribute for each group but if you have a date that is in 2 groups with different colours it will display only one colour.
To allow we have a combination of markers via custom css I would suggest add a style class attribute to the
my-marked-date.interface
I created a local branch and it worked well for me. Though, I am not allowed to create a PR.
So I can publish my suggestions here, if you are happy to handle:
At angular-mydatepicker.util.service.ts I changed the method isMarkedDate as bellow:
At the end I changed day-view.component.html at line 21 as follow:
<span *ngIf="d.markedDate.marked" class="myDpMarkDate{{d.markedDate.styleClass}}" [ngStyle]="{'border-top': '8px solid ' + d.markedDate.color}"></span>
That will allow also to keep the current behaviour.
Thanks for take this in consideration :)
The text was updated successfully, but these errors were encountered: