Skip to content

Function: calculateSessionTimeValues()

function calculateSessionTimeValues(
activeSeconds,
startTime,
timerRoundingSettings): {
calculatedEndTime: Date;
finalActiveSeconds: number;
normalizedStartTime: Date;
};

Defined in: shared/src/helper/workHelper/timeTrackerFunctions.ts:42

Calculates the time values for a timer session.

This function:

  1. Calculates the final active seconds (applying rounding if not using time fragments)
  2. Normalizes the start time to the beginning of the minute (removes seconds/milliseconds)
  3. Calculates the end time based on active

Note: The distinction between true_end_time (actual end) and end_time (calculated end based on rounded time) allows tracking of actual vs billed time.

ParameterTypeDescription
activeSecondsnumberRaw active seconds from the timer
startTimenumber | nullOriginal start timestamp (can be null)
timerRoundingSettingsTimerRoundingSettingsPermanent rounding settings
{
calculatedEndTime: Date;
finalActiveSeconds: number;
normalizedStartTime: Date;
}

Object containing finalActiveSeconds, normalizedStartTime, and calculatedEndTime

NameTypeDefined in
calculatedEndTimeDateshared/src/helper/workHelper/timeTrackerFunctions.ts:70
finalActiveSecondsnumbershared/src/helper/workHelper/timeTrackerFunctions.ts:68
normalizedStartTimeDateshared/src/helper/workHelper/timeTrackerFunctions.ts:69