harsh-harlequin
harsh-harlequinβ€’2y ago

Inferencer date inferring is too sensitive

Hi πŸ™‚ Another issue I've encountered. I have a number field, that the Inferencer recognizes as a Date field. I don't really know why, but I suspect perhaps that it might be the length of the checked value matches a length you expect for a date value? Anyway, I don't really want to never infer dates by overriding it in the fieldTransformer, and I can't really do it for a specific field because it might happen in a different one as well. Should I open an issue on github for this?
12 Replies
refine-support-bot
refine-support-botβ€’2y ago
Hi, I am refine support bot :wave:. I am here to help you with your question. I searched for the answer to your question in the refine documentation and found an answer! πŸ†
Answer: The president did not mention Michael Jackson. SOURCES: 0-pl, 24-pl, 5-pl, 34-pl

Note: If this is the answer you need, then we are very lucky. If not, please wait for someone from the refine core team or the community to try to help you.
harsh-harlequin
harsh-harlequinβ€’2y ago
Lmao what is that answer 🀣
absent-sapphire
absent-sapphireβ€’2y ago
Hello, @YechiamTK Can you create an issue with more details? It's hard to guess, what's the problem from the message. Best,
harsh-harlequin
harsh-harlequinβ€’2y ago
Sure πŸ™‚ Welp, I see that the field is a string type not number; that's probably more reasonable why it gets inferred as date @batuhanw is there perhaps somewhere in the docs the criteria for inferring a string as a date? Perhaps instead of opening an issue I'll first check that my field should actually not be inferred as date
absent-sapphire
absent-sapphireβ€’2y ago
Here you can see the criteries for inferring field as date: https://github.com/refinedev/refine/blob/abcd9a7ed6bc0070b386a9fdc4bf95d9187bf7c3/packages/inferencer/src/field-inferencers/date.ts#L6 It could be a bug with regexp I guess, could you let me know an example value for this field?
GitHub
refine/date.ts at abcd9a7ed6bc0070b386a9fdc4bf95d9187bf7c3 Β· refine...
Build your React-based CRUD applications, without constraints. - refine/date.ts at abcd9a7ed6bc0070b386a9fdc4bf95d9187bf7c3 Β· refinedev/refine
harsh-harlequin
harsh-harlequinβ€’2y ago
Yeah I'm opening an issue and putting some example values there; perhaps the dayjs library has some weird isValid check that makes it actually seem like a date I'll tag you in the issue and provide a link to this discussion
harsh-harlequin
harsh-harlequinβ€’2y ago
ok yeah didn't find you on the github tag, this is the issue: https://github.com/refinedev/refine/issues/3635
GitHub
[BUG] Date inference too sensitive Β· Issue #3635 Β· refinedev/refine
Describe the bug Hi :) In one of my resources I have a string field that for some reason the Inferencer recognizes as a date field. The field values can be, for example: "112312",...
absent-sapphire
absent-sapphireβ€’2y ago
@YechiamTK thanks for the contribution and details! We'll follow up soon!
harsh-harlequin
harsh-harlequinβ€’2y ago
Thanks πŸ™‚
absent-sapphire
absent-sapphireβ€’2y ago
I just cracked couple of tests for this case, and you are right, indeed, according to dayjs library, these are valid dates πŸ˜„ πŸ€·β€β™‚οΈ We'll be fixing it soon
absent-sapphire
absent-sapphireβ€’2y ago
Hello @YechiamTK , created a PR for this issue, https://github.com/refinedev/refine/pull/3636
GitHub
WIP: fix: update date inferencer to check existence of date separat...
IMPORTANT: Please do not create a Pull Request without creating an issue first. Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request....
harsh-harlequin
harsh-harlequinβ€’2y ago
Awesome! Thanks for the always fast response πŸ˜„