Skip to content

undefined is not an object (evaluating 'r[0].toUpperCase') #271

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

Closed
nachodeh opened this issue Aug 22, 2024 · 6 comments
Closed

undefined is not an object (evaluating 'r[0].toUpperCase') #271

nachodeh opened this issue Aug 22, 2024 · 6 comments

Comments

@nachodeh
Copy link

nachodeh commented Aug 22, 2024

This is happening consistently on Safari (iOS or Mac OS) when using a basic DatePicker with the default config (null starting date value)

The error is thrown here:

return `${(value[0] || "")?.toUpperCase()}${(value || "")?.slice(1, value.length)}`;

Doesn't happen on other OSs

@patrickrbc
Copy link

Happens to me as well, if I downgrade (npm i [email protected]) it works.

@onesine
Copy link
Owner

onesine commented Aug 23, 2024

Hi @nachodeh, @patrickrbc ,

Thank you for this return and thank you for using our package.

The only endroid in the code where we use a similar expression to your code is the ucFirst

export function ucFirst(value: string) {
    return `${(value[0] || "")?. toUpperCase()}${(value || "")?. slice(1, value.length)}`;
}

We have production applications too, but we don’t have this problem. I just made a small change. I hope this will solve your problem.

@onesine
Copy link
Owner

onesine commented Aug 23, 2024

@nachodeh, @patrickrbc I have just released version 1.7.1. Please update and retest to see if you still have this problem.

@nachodeh
Copy link
Author

Thanks for the prompt update. It's a very weird one. I think some other dependency in my code may be causing it.

For now I switched to a different date picker but will test with the updated version ASAP and get back to you

@onesine
Copy link
Owner

onesine commented Aug 23, 2024

You're welcome. I will wait for your answer. Feel free to add feedback, if you have any other concerns.

@nachodeh
Copy link
Author

@onesine Just checked with the latest version and the issue is resolved. Thanks!

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

3 participants