Skip to content

Function: getTimeSectionSessions()

function getTimeSectionSessions(
start,
end,
timeSectionInterval,
originalSession): {
active_seconds: number;
created_at?: string;
currency?: | "USD"
| "EUR"
| "GBP"
| "CAD"
| "AUD"
| "JPY"
| "CHF"
| "CNY"
| "INR"
| "BRL"
| "VEF";
end_time: string;
hourly_payment?: boolean;
id?: string;
memo?: string | null;
paid?: boolean;
payout_id?: string | null;
salary: number;
start_time: string;
time_fragments_interval?: number | null;
user_id?: string;
work_project_id?: string;
}[];

Defined in: shared/src/helper/workHelper/workHelperFunctions.ts:84

Splits a session into multiple time blocks based on the specified interval.

Example: If a session runs from 17:17 to 17:36 and timeSectionInterval is “10min”, it will create 3 sessions:

  • 17:10-17:20 (3 minutes active: 17:17-17:20)
  • 17:20-17:30 (10 minutes active: 17:20-17:30)
  • 17:30-17:40 (6 minutes active: 17:30-17:36)
ParameterTypeDescription
startDateStart time of the original session
endDateEnd time of the original session
timeSectionIntervalnumberTime interval for splitting (5, 10, 15, 30, 60)
originalSession{ active_seconds: number; created_at?: string; currency?: | "USD" | "EUR" | "GBP" | "CAD" | "AUD" | "JPY" | "CHF" | "CNY" | "INR" | "BRL" | "VEF"; end_time: string; hourly_payment?: boolean; id?: string; memo?: string | null; paid?: boolean; payout_id?: string | null; salary: number; start_time: string; time_fragments_interval?: number | null; user_id?: string; work_project_id?: string; }Optional original session data to copy properties from
originalSession.active_secondsnumber-
originalSession.created_at?string-
originalSession.currency?| "USD" | "EUR" | "GBP" | "CAD" | "AUD" | "JPY" | "CHF" | "CNY" | "INR" | "BRL" | "VEF"-
originalSession.end_timestring-
originalSession.hourly_payment?boolean-
originalSession.id?string-
originalSession.memo?string | null-
originalSession.paid?boolean-
originalSession.payout_id?string | null-
originalSession.salarynumber-
originalSession.start_timestring-
originalSession.time_fragments_interval?number | null-
originalSession.user_id?string-
originalSession.work_project_id?string-

{ active_seconds: number; created_at?: string; currency?: | "USD" | "EUR" | "GBP" | "CAD" | "AUD" | "JPY" | "CHF" | "CNY" | "INR" | "BRL" | "VEF"; end_time: string; hourly_payment?: boolean; id?: string; memo?: string | null; paid?: boolean; payout_id?: string | null; salary: number; start_time: string; time_fragments_interval?: number | null; user_id?: string; work_project_id?: string; }[]

Array of session objects split into time blocks