-
Notifications
You must be signed in to change notification settings - Fork 152
copy-paste of numbers in numeric cells pastes a different number than the copied one. #500
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
Comments
I'm almost sure it's something with parseLocaleNumber function but I didn't quite nailed it. funny thing is that I have the very same issue when I'm pasting with ctrl+v, but context menu paste works fine. I am suspicious of locale parsing as I copied values from an excel that came from a customer from new Zealand, cause when I created an excel it works fine. but pasting to notepad or via context menu works as expected. Just ctrl + v behaves like OP described. also! as you can see in the video - my issue only occurs when a number is less than 1000 424348395-c7d43ed2-7cba-451e-9639-cc6631a7c83d.mov |
@Sturez I confirm this bug too. Only works up to v 4.1.13. I have same behavior and hope the develops of this lib will fix this bug! |
ok, I have some new discovering regarding this. My suspicion is that if a pasted number can be interpreted as a Date - it will be somehow transformed to date number. I've created a small proof of this. @webloopbox sorry if I'm mistaken but I'm guessing you're a maintainer of this repo? is there any doc/md how do you set up development env? so I could run it locally and debug some more maybe even do a fix? I'm pretty in hurry with this one https://stackblitz.com/edit/vitejs-vite-mckpxusj?file=src%2FApp.tsx EDIT: I think I found the issue: reactgrid/src/lib/Functions/handlePaste.ts Lines 44 to 47 in eeef7ba
I'm not sure how to approach it though - to be honest the only thing that would cover probably most of use cases (but wouldn't be 100% bulletproof) - is to check if the pasted string has at least two "." - then try to parse it as excel date, if it's only one - prioritize parsing as a number. |
@MateuszTrN I will try to deal with this issue as quickly as possible. If you need to run version 4 of reactgrid locally, you should switch to the develop branch. Starting it is pretty simple, there are no extra steps needed. |
yup,i figure the running part out, I just wasnt expecting it was THAT easy 🤣 anyway, I've set up a PR, it is A solution, but i'm not 100% it is THE solution. thanks for quick reply. let me know if i coule help. |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
When I copy-paste a number such as 990.06 from a notepad to a numeric cell, the number is very different. If I copy-paste from the grid itself, it works. I've tested also using the current development branch (column 0 - 3). Tested with version 4.1.13 and the problem is not there, it must be something specific of version 4.1.14.
Current behavior
When we paste 990.06 we get -30 912 713 608 000,00
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots or gifs
Your environment details
The text was updated successfully, but these errors were encountered: