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

Setting a default date range error #71

Open
craigwillis85 opened this issue Sep 14, 2018 · 5 comments
Open

Setting a default date range error #71

craigwillis85 opened this issue Sep 14, 2018 · 5 comments

Comments

@craigwillis85
Copy link

I'm trying to set a default date, using the initRange prop, but I'm getting an error.

I have a data property called dateRange

    data: function () {
        return {
            dateRange: {
                'start': '2018-09-14',
                'end': '2018-09-15',
            }
        }
    }

Which I'm passing to the component:

<vue-rangedate-picker @selected="onDateSelected" i18n="EN" righttoleft="false" initRange="dateRange"></vue-rangedate-picker>

But this is throwing the following error:

[Vue warn]: Invalid prop: type check failed for prop "initRange". Expected Object, got String.

This is odd, since the prop I'm passing is an object, unless I'm mistaken?

@mediavariance
Copy link

I believe your initRange needs to be prefixed with a colon:
<vue-rangedate-picker @selected="onDateSelected" i18n="EN" :righttoleft="false" :initRange="dateRange"></vue-rangedate-picker>

@kiasyn
Copy link

kiasyn commented Sep 19, 2018

using :init-range worked for me

@craigwillis85
Copy link
Author

using :init-range worked for me

Unfortunately, this hasn't worked either. I still don't see any default values in the datepicker

@kiasyn
Copy link

kiasyn commented Sep 20, 2018

ah, I may be using the winslow fork... https://github.com/gwindes/vue-rangedate-picker-winslow

@jinfeicheng
Copy link

It's worked for me. Try like this:
Use this forked version instead of the origin version.
https://github.com/gwindes/vue-rangedate-picker-winslow
(this week as default )
<vue-rangedate-picker :initRange="datePickerConfig.initRange"
const datePickerConfig = {
initRange: {
start: moment().startOf('week').add(2,'days')._d,
end: moment().startOf('week').add(8,'days')._d
}
}

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

4 participants