-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Before you submit this issue, have you checked the following
- Is this really a problem?
- I have searched the Github Issues for similar issues, but did not find anything.
Affected packages and versions
0.10.14, 0.12.4, 0.14.0
Reproduction link
https://stackblitz.com/edit/univer-sheets-vite-cfpfg2nd?file=src%2Fmain.ts
Expected behavior
When comparing a cell reference containing "2025-01-01" as string literal(not a formatted number), and another string literal "2026-01-01"
=A1>="2026-01-01"
The expected output is FALSE,
Actual behavior
Univer always returns TRUE in such cases.
Diving deeper into the code it looks like Univer tries to interpret the RHS i.e "2026-01-01" as date, and hence while doing comparison does a comparison like
"2025-01-01" >= 4555
Whenever a string is compared against a number with >=, univer formula engine always returns TRUE.
This behavior is completely different from MS Excel, and Google Sheet, where they seem to do lexical comparison of the LHS and RHS.
Screenshot 1 -> Incorrect formula output

Screenshot 2 -> Correct formula output when TEXT() function is used to skip automatic type conversion

Screenshot 3 -> Correct formula output when TEXT() function is used to skip automatic type conversion

System information
No response