getDefaultDatesOfCultivation
@svenvw/fdm-source / fdm-core/src / getDefaultDatesOfCultivation
Function: getDefaultDatesOfCultivation()
getDefaultDatesOfCultivation(
fdm,principal_id,b_id_farm,b_lu_catalogue,year):Promise<CultivationDefaultDates>
Defined in: fdm-core/src/cultivation.ts:191
Alpha
Retrieves the default start and end dates for a given cultivation in a specific year.
This function checks for read permissions on the farm, then queries the cultivation catalogue to find the default sowing and harvest dates for the specified cultivation. It constructs Date objects for the given year. For single-harvest crops, it calculates the default end date and adjusts the year if the sowing date felt into the previous calendar year.
Parameters
fdm
any
The FDM instance providing the connection to the database.
principal_id
any
The ID of the principal making the request.
b_id_farm
any
The ID of the farm.
b_lu_catalogue
any
The catalogue ID of the cultivation.
year
number
The year for which to determine the default dates.
Returns
Promise<CultivationDefaultDates>
A Promise that resolves with an object containing the default start and end dates.
Throws
If the cultivation is not found in the enabled catalogues for the farm.