Skip to main content

toKgPerHa

@nmi-agro/fdm-source


@nmi-agro/fdm-source / fdm-core/src / toKgPerHa

Function: toKgPerHa()

toKgPerHa(value, unit, density?): number

Defined in: fdm-core/src/fertilizer-application-unit-conversion.ts:24

Alpha

Convert a user-entered amount (in display unit) to kg/ha for storage.

Uses Decimal.js to avoid floating-point rounding errors. Throws if conversion requires density but density is null/undefined/0.

Parameters

value

any

The value to convert.

unit

AppAmountUnit

The display unit of the value.

density?

any

The density of the fertilizer in kg/l. Required for volume-based units.

Returns

number

The converted value in kg/ha.