question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug / unexpected behavior with leading zeros - number / string widget

See original GitHub issue

Big bug on my side.

I wanna have a color picker / HEX sort of thing. Right now it’s just numbers, but if I have a HEX code that starts with zeros, the end result is wrong.

008000 generates 8000. Help.

https://github.com/cstate/cstate/issues/83

image

If I try and enter "008000", there’s double quotes which confuse Hugo. In turn, the color HEX becomes #ZgotmplZ.

Is there something I can do to prevent the assumption that I don’t need the first two zeros?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
erquhartcommented, Oct 13, 2019

The CMS isn’t removing the zeros. I would expect the double quotes to be from quotes being manually added to the string input.

Sent with GitHawk

0reactions
erquhartcommented, Oct 28, 2019

The source shows zeroes, but any yaml -> json converters I can find drop the leading zeroes if quotes are not present. That said, I think I found my final recommendation: include the leading hash. A hex code is supposed to begin with a hash to be valid, and doing so ensures leading zeroes never drop. I’d recommend storing hashes in your raw values.

Read more comments on GitHub >

github_iconTop Results From Across the Web

String example fields are incorrectly converted to numbers ...
String example values with leading zeros are treated as numbers, with quotes being stripped during bundling, resulting in failing schema ...
Read more >
Leading zeros are not allowed in Python? - Stack Overflow
Integer literals starting with 0 are illegal in python (other than zero itself, obviously), because of ambiguity.
Read more >
How to Fix You have Been Kicked Due Unexpected Client ...
How to Fix You have Been Kicked Due Unexpected Client Behavior Roblox Exploiting Error Code 268!!
Read more >
Bug listing with status RESOLVED with resolution FIXED as at ...
Bug :2 - "How do I attach an ebuild." status:RESOLVED resolution:FIXED severity:normal · Bug:3 - "poedit-1.1.5.ebuild" status:RESOLVED resolution:FIXED ...
Read more >
EZYXxxxx messages - IBM
XmNmustMatch is always False for a Command widget. EZYXM26W XmNhistoryMaxItems must be a positive integer greater than zero.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found