Skip to content

[5.x]: Float numbers in GraphQL weird behaviour #15222

@ishetnogferre

Description

@ishetnogferre

What happened?

Description

We're using the number fields to store longitude and latitude because we only need these values. In the front-end we us GraphQL to query between two numbers.

Steps to reproduce

  1. Have a Numbers field, set to 16-20 decimals
  2. Query the exact number
  3. Query between 2 numbers with decimals

Expected behavior

In case 2: have the exact entry returned
In case 3: have the entry and others returned

Actual behavior

  1. When using the exact number, an error show we can only use string, integer or boolean.
    Screenshot 2024-06-18 at 10 29 27
Screenshot 2024-06-18 at 10 29 20
  1. When using a simple comparison (>= or <=), it show the correct entry and more
Screenshot 2024-06-18 at 10 30 47
  1. When using a range, it shows none
Screenshot 2024-06-18 at 10 30 58

Extra
Don't know if this is expected behaviour but the filter input doesn't incorporate the decimal setting from the Number field.
Screenshot 2024-06-18 at 10 39 56

Craft CMS version

Craft 5.2.0

PHP version

8.2

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions