The default value from a DocField in a Doctype of type "Percent" comes as a string

The default value is received as a string type, which causes issues related to type when I use it later.




Hi

You can change it value into Float by below method

let n = "4.5"
let num = parseFloat(n)

However, I noticed that after modifying the field or loading the data, the value is seen as a number type. I’m wondering if having the default value as a string is actually correct?

So for a field of type ‘percent’, I need to write a conversion function to support cases where the value comes from a default value ?

For floating use flt