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

Error: DatePicker context missing. Please verify this component is nested within a valid context provider. #17

Open
simonmaass opened this issue Jul 1, 2024 · 5 comments

Comments

@simonmaass
Copy link

In sentry i can see the following error:

TypeError: undefined is not an object (evaluating 'i.value.modelValue')
TypeError: failed to format relative time

Screenshot from user:
image

User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15

@samk-dev
Copy link
Owner

samk-dev commented Jul 1, 2024

hey @simonmaass thanks for reporting. please could you provide a minimal reproduction. It would be helpful to know what data type is being passed to the modelValue it seems like an issue with vcalendar itself.

Thanks

@simonmaass
Copy link
Author

nathanreyes/v-calendar#1482

@samk-dev
Copy link
Owner

samk-dev commented Jul 1, 2024

could you please to see the data type is being passed to the model value? something like this 2010-11-15T14:32:28-0500?? did you pass any custom config to <DatePicker />??

@simonmaass
Copy link
Author

simonmaass commented Jul 1, 2024

everything is wrapped in ClientOnly..

<VDatePicker
    v-model.string="appointmentDate"
    is-required
    expanded
    :first-day-of-week="2"
    borderless
    locale="de"
    :min-date="minDate.format('YYYY-MM-DD')"
    :max-date="maxDate.format('YYYY-MM-DD')"
    :disabled-dates="disabledDates"
    :masks="{ modelValue: 'YYYY-MM-DD' }"
  ></VDatePicker>

const appointmentDate = ref<string | undefined>('')

This is the error: TypeError: undefined is not an object (evaluating 'i.value.modelValue')

@samk-dev
Copy link
Owner

samk-dev commented Jul 1, 2024

with the reproduction from the previous comment when I pass a date string like this one 2000-01-01T12:00:00.000Z it works good, I had to remove :min-date and :max date as I don't know what shape is your data.

You could try to change the type of appointmentDate from string | undefined to string | null as the docs shows the mode-value type https://vcalendar.io/datepicker/api.html#api

also I am not sure what data is being received in appointmentDate is a dateString? just to make sure add toDateString v-model.string="appointmentDate.toDateString()" this happened to me recently and was a bug in the backend I was using that sometimes retuned broken dates like this one -0001-11-30T00:00:00-0500

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants