File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
packages/loot-core/src/shared Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,12 @@ import { t } from 'i18next';
3
3
4
4
import { FieldValueTypes , RuleConditionOp } from '../types/models' ;
5
5
6
- import { integerToAmount , amountToInteger , currencyToAmount } from './util' ;
6
+ import {
7
+ integerToAmount ,
8
+ amountToInteger ,
9
+ currencyToAmount ,
10
+ getNumberFormat ,
11
+ } from './util' ;
7
12
8
13
// For now, this info is duplicated from the backend. Figure out how
9
14
// to share it later.
@@ -374,10 +379,22 @@ export function makeValue(value, cond) {
374
379
switch ( cond . type ) {
375
380
case 'number' : {
376
381
if ( cond . op !== 'isbetween' ) {
382
+ const stringValue = String ( value ) ;
383
+ const { decimalSeparator } = getNumberFormat ( ) ;
384
+
385
+ // preserve trailing decimal separator to allow decimal input during typing
386
+ if ( stringValue && stringValue . endsWith ( decimalSeparator ) ) {
387
+ return {
388
+ ...cond ,
389
+ error : null ,
390
+ value : stringValue ,
391
+ } ;
392
+ }
393
+
377
394
return {
378
395
...cond ,
379
396
error : null ,
380
- value : value ? currencyToAmount ( String ( value ) ) || 0 : 0 ,
397
+ value : value ? currencyToAmount ( stringValue ) || 0 : 0 ,
381
398
} ;
382
399
}
383
400
break ;
Original file line number Diff line number Diff line change
1
+ ---
2
+ category : Bugfix
3
+ authors : [matt-fidd]
4
+ ---
5
+
6
+ Allow decimals numbers to be typed into amount filter
You can’t perform that action at this time.
0 commit comments