diff --git a/common/src/app/common/data.cljc b/common/src/app/common/data.cljc index 86a733ee28..e9bb3a918f 100644 --- a/common/src/app/common/data.cljc +++ b/common/src/app/common/data.cljc @@ -782,7 +782,8 @@ (not (js/isNaN v)) (not (js/isNaN (parse-double v)))) - :clj (not= (parse-double v :nan) :nan))) + :clj (and (string? v) + (not= (parse-double v :nan) :nan)))) (defn read-string [v] diff --git a/common/test/common_tests/data_test.cljc b/common/test/common_tests/data_test.cljc index d85e835af9..3228ec0298 100644 --- a/common/test/common_tests/data_test.cljc +++ b/common/test/common_tests/data_test.cljc @@ -841,6 +841,9 @@ (t/is (d/num-string? "-7")) (t/is (not (d/num-string? "hello"))) (t/is (not (d/num-string? nil))) + ;; non-string types always return false + (t/is (not (d/num-string? 42))) + (t/is (not (d/num-string? :keyword))) ;; In CLJS, js/isNaN("") → false (empty string coerces to 0), so "" is numeric #?(:clj (t/is (not (d/num-string? "")))) #?(:cljs (t/is (d/num-string? ""))))