I converted the logic you posted in arcade to javascipt, so OP can do the calculation on the S123 form using javascript fuctions.
function calculateFiscalYear(input_date, startMonth) {
// Specify the month when the fical year starts
// Use 1 for January all the way up to 12 for December
const date = new Date(input_date);
const curr_month = date.getMonth() +1;
if(curr_month >= startMonth) {
return date.getFullYear();
} else {
return date.getFullYear() + 1;
}
}
An on the calculation field use:
pulldata("@javascript", "functions.js", "calculateFiscalYear", ${<input_date>}, ${<startMonth>})