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

[IDEA] add a 'format' attribute to EditTextWidget (and maybe others) #8589

Open
ittayd opened this issue Sep 8, 2024 · 2 comments
Open

[IDEA] add a 'format' attribute to EditTextWidget (and maybe others) #8589

ittayd opened this issue Sep 8, 2024 · 2 comments

Comments

@ittayd
Copy link

ittayd commented Sep 8, 2024

Is your feature request related to a problem? Please describe.
When creating calculatros, a lot of time a field will hold an accurate number (e.g. 293.70629370629365), but I want to see something rounded (293.71). The accurate number may come because of some calculation derived from other fields (the edit text widget is used to override it, so then the user can type what they want)

Describe the solution you'd like
A format attribute can hold a filter to format the value before setting it in the input element.

Describe alternatives you've considered

Additional context

@kookma
Copy link
Contributor

kookma commented Sep 12, 2024

I think when you store the value in the field you can format it!
In other words, if the meaningful number of digits after floating point is 2, then storing and calculating with 16 digits has no meaning!

@pmario
Copy link
Member

pmario commented Sep 12, 2024

We do have the "fixed" operator https://tiddlywiki.com/#fixed%20Operator that will allow you to change the value in the field when storing it.

But

I think what you really want is to keep the "exact" number in the field and just show it with a fixed value.

I think that request is valid.

But we have to define, how the input-field should behave if it gets focus.

  • Should it show the "fixed" value - or
  • should it show the "real" value

IMO this depends on what should be done with those values. As soon as money comes into play these questions become important. Because:

  • rounding up 10 values and then adding them is significantly different to
  • adding 10 values and then rounding up the sum

An other question is:

  • What if the value is an integer and should be formatted eg: 10.00 without converting it to a float.
  • So the input 20 has to write the value 2000 into the field

So while the request seems to be a simple modification. IMO it is not. There will be quite some thinking, which has to go into it.

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

No branches or pull requests

3 participants