Open pedrojfernandez opened 10 months ago
Hey team reflex, this seems like a good first issue. Would love to take this up!
@etaldot sounds good! Just assigned you to it
I think for this you have to modify the Var.__format__
method here: https://github.com/reflex-dev/reflex/blob/ce47fcfd6cf0f2886c95363b6b84fe3950d07b4e/reflex/vars.py#L279
We will have to read the format_spec
and compile it out to the equivalent JS code to format the number
Hi @picklelo thanks for the directions. I will put up a PR today.
Still doesn't work?
@picklelo @socalledso Any updates on this bug? Seems to still be present in 0.4.9.
Up
I'm trying to format a float as a currency (euros) and I'm using f string for that:
rx.text (f"{AppState.total:.2f}€")
but when the string is generated, if the number has any right decimal equal to zero, they don't appear. For example: float 6, I want to get "6.00€", but I get "6€". Any idea? In a empty python script it works, but not inside this "framework". May be something is happening in between in the rx.text component generating the output.