Skip to content
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

[5.x]: Number fields without decimal points still store decimal values #16181

Closed
MoritzLost opened this issue Nov 21, 2024 · 2 comments
Closed
Assignees
Labels

Comments

@MoritzLost
Copy link
Contributor

MoritzLost commented Nov 21, 2024

What happened?

Description

We have a Number field that's set to Decimal Points: 0. Entering a decimal value, like 5.6 will round the value up or down in the Control Panel when the entry is saved, displaying (in this case) 6 in the Control Panel. But in the frontend, the field will still output 5.6 instead of 6.

Steps to reproduce

  1. Create a Number field and set the Decimal Points to 0, leave the rest of the settings at the default.
  2. Add the number field to an entry type.
  3. In any entry of that type, enter a decimal value like 5.6 in the Number field (with the accounts Formatting Locale set to English).
  4. Save the entry. Inspect the value in the entry form in the Control Panel, and output it in a frontend template.

Expected behavior

Decimal values should be rounded up or down upon saving, or display a validation error.

Actual behavior

The Control Panel and frontend output show different values.

Craft CMS version

5.5.1.1

PHP version

8.3

Operating system and version

No response

Database type and version

MySQL 8

Image driver and version

No response

Installed plugins and versions

@i-just
Copy link
Contributor

i-just commented Nov 22, 2024

Hi, thanks for reporting! I raised a PR for this.

@brandonkelly
Copy link
Member

Craft 5.5.3 is out with the fix for this. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants