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

feat: add "is-start" and "is-end" to the first and last dates respectively #28

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

MrMohamedAbdallah
Copy link

That feature allow users to style the first and last cell in the dates range and single date.

For example, adding a border radius to the first and last ones.

image

…ively

If the cell is the first cell on the daterange it will have "is-start"
class, If it's the last one it will have "is-end" class.
If it's a single datepicker, the active cell will have both classes.
@mengxiong10
Copy link
Owner

You can use getClasses prop.

<date-picker :get-classes="getClasses" />
{
  methods: {
    getClasses(cellDate, innerValue) {
        const length = innerValue.length
        const classes = []
        if (length) {
            if (cellDate.getTime() == innerValue[0].getTime()) classes.push('is-start');
            if (cellDate.getTime() == innerValue[length - 1].getTime()) classes.push('is-end');
        }
        return classes
     }
  }
}

@MrMohamedAbdallah
Copy link
Author

Yeah, but that PR is to make it a feature in the library itself.
It will make it easier for styling, no need to add the getClasses prop in each instance for such a simple classes.

@MrMohamedAbdallah
Copy link
Author

@mengxiong10 will that be merged soon?

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