🐛 Negative numbers are treated as positive numbers when calculating template field values https://github.com/siyuan-note/siyuan/issues/11446

This commit is contained in:
Daniel 2024-05-17 21:42:42 +08:00
parent 0ad0d416c4
commit b670cdb29a
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -124,7 +124,7 @@ func Convert2Float(s string) (float64, bool) {
s = strings.ReplaceAll(s, ",", "")
buf := bytes.Buffer{}
for _, r := range s {
if unicode.IsDigit(r) || '.' == r {
if unicode.IsDigit(r) || '.' == r || '-' == r {
buf.WriteRune(r)
}
}