15 lines
445 B
TypeScript
15 lines
445 B
TypeScript
import { dateToReportDay } from './reportDay.ts';
|
|
|
|
export function isCycleClosed(endDate?: Date | string | null): boolean {
|
|
if (endDate == null || endDate === '') return false;
|
|
return true;
|
|
}
|
|
|
|
export function closedCycleUpToDay(
|
|
startDate: Date | string,
|
|
endDate?: Date | string | null
|
|
): number {
|
|
if (!isCycleClosed(endDate) || endDate == null || endDate === '') return 0;
|
|
return Math.max(0, dateToReportDay(startDate, endDate));
|
|
}
|