mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Fix: Dont parse numbers with exponent as integer (#5457)
This commit is contained in:
		| @@ -60,4 +60,9 @@ describe('NumberComponent', () => { | ||||
|     component.writeValue(11.1) | ||||
|     expect(component.value).toEqual(11.1) | ||||
|   }) | ||||
|  | ||||
|   it('should support scientific notation', () => { | ||||
|     component.writeValue(1.23456789e8) | ||||
|     expect(component.value).toEqual(123456789) | ||||
|   }) | ||||
| }) | ||||
|   | ||||
| @@ -37,7 +37,8 @@ export class NumberComponent extends AbstractInputComponent<number> { | ||||
|   } | ||||
|  | ||||
|   writeValue(newValue: any): void { | ||||
|     if (this.step === 1) newValue = parseInt(newValue, 10) | ||||
|     if (this.step === 1 && newValue?.toString().indexOf('e') === -1) | ||||
|       newValue = parseInt(newValue, 10) | ||||
|     if (this.step === 0.01) newValue = parseFloat(newValue).toFixed(2) | ||||
|     super.writeValue(newValue) | ||||
|   } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 shamoon
					shamoon