Skip to content

Conversation

mslowin
Copy link

@mslowin mslowin commented Jun 25, 2025

📝 Description

Fixed input behavior in workout set forms to automatically remove leading zeros when users type values. Previously, users could enter values like "002" which would remain displayed as such, causing potential confusion. Now, leading zeros are immediately stripped from numeric inputs via regex while maintaining proper functionality for empty values and single zeros.

📋 Checklist

  • My code follows the project conventions
  • This PR includes breaking changes
  • I have updated documentation if necessary

🗃️ Prisma Migrations (if applicable)

  • I have created a migration
  • I have tested the migration locally

🔗 Related Issues

Fixes #97

Copy link

vercel bot commented Jun 25, 2025

@mslowin is attempting to deploy a commit to the Workoutcool Team Team on Vercel.

A member of the Team first needs to authorize it.

@Snouzy
Copy link
Owner

Snouzy commented Jun 26, 2025

Hey @mslowin, I tested this on my side I was able to reproduce the issue with leading zeros, but unfortunately the current fix doesn't seem to solve it yet. Maybe i am missing something? Leading zeros still appear on my end

Could be something small missing in the logic happy to help if you need a second pair of eyes

screenshot-2025-06-27_00h06m11s.mp4

@mslowin
Copy link
Author

mslowin commented Jun 27, 2025

That's interesting, because I've tested it locally and everything seemed to work just fine. Here is the video with the keys that I was pressing in the bottom right corner

leadingZeros.mp4

@Snouzy
Copy link
Owner

Snouzy commented Jun 29, 2025

just re-tested on my side and I'm still seeing those leading zeros pop up. I get why you tried to strip them out, but we actually need to keep them in some cases (for example when you add 0.5 kg of weight). Could you take another look at the logic to see if we can conditionally allow decimals while trimming zeros elsewhere?

@mslowin
Copy link
Author

mslowin commented Jun 30, 2025

@Snouzy I've changed the logic behind removing leading zeros - instead of regex, I’m now just converting the string to a float with 2 decimal places. It’s not fully done yet (REPS and MINUTES still allow floats), but I just wanted to ask if You could test it on your side if it works

@mslowin
Copy link
Author

mslowin commented Jul 17, 2025

Hi @Snouzy, were you able to take a look at this maybe?

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

Successfully merging this pull request may close these issues.

Inputs allow leading zeros (e.g. "030" seconds or "0021" kg)
2 participants