File tree Expand file tree Collapse file tree
services/libs/data-access-layer/src/affiliations Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -199,13 +199,13 @@ function collectBoundaries(datedRows: IWorkRow[]): Date[] {
199199
200200function orgsActiveAt ( rows : IWorkRow [ ] , boundaryDate : Date ) : IWorkRow [ ] {
201201 return rows . filter ( ( role ) => {
202- if ( ! role . dateStart ) return true // undated: active at every boundary
202+ if ( ! role . dateStart && ! role . dateEnd ) return true // truly undated: active at every boundary
203203
204- const roleStart = startOfDay ( role . dateStart )
204+ const roleStart = role . dateStart ? startOfDay ( role . dateStart ) : null
205205 const roleEnd = role . dateEnd ? startOfDay ( role . dateEnd ) : null
206206
207207 // org is active if the boundary date falls within its employment period
208- return boundaryDate >= roleStart && ( ! roleEnd || boundaryDate <= roleEnd )
208+ return ( ! roleStart || boundaryDate >= roleStart ) && ( ! roleEnd || boundaryDate <= roleEnd )
209209 } )
210210}
211211
You can’t perform that action at this time.
0 commit comments